Earlier quoted context omitted.
My python is rusty but IIRC it allows functional stuff (except for expression-only lambdas, boo). From https://docs.python.org/3/howto/functional.html it's got map/filter/currying and plenty more, what's misting in your view?
pattern matching expressions, syntax for partial application and composition, a typing system which can express structural types, a generalised list comprehension
Available in 3.10: https://peps.python.org/pep-0636/
> syntax for partial application...
from functools import partial
somefunc_arg1_arg2 = partial(somefunc, arg1, arg2)
> ...and compositionA native compositional syntax would be nice.
> a typing system which can express structural types
# mypy will typecheck this code and see `MyString()` has a `.read()` method, so it's a `Readable` even though it doesn't sub-class `Readable`
from typing import Any, Protocol
class Readable(Protocol):
def read(self) -> Any: ...
def read_something(something: Readable) -> Any:
return something.read()
class MyString:
a_string: str = "something"
def read(self) -> str:
return self.a_string
read_something(MyString())
> a generalised list comprehensionI agree this would be nice.