by devnonymous · 9y ago · 0 comments
In language that pythonistas would grok:
Arrow functions: multiline lambda definitions
method shorthand definition syntax: class defined with only classmethods, or in other words a namespace
the spread operator: *args in functions
destructuring assignments: tuple unpacking... But also for creation of instances
all functional Array methods and async functions: functools and async... Plus a bit more
While most of this is good to know, I'd still stick with python for readability and maintainability purposes.
And to be clear, I would classify, say, Rust as not having many arbitrary restrictions. All the limitations that Rust has compared to C fit clearly within the language's core design. On the other hand, I don't see this same structure and consistency to some of Python's rules.
In Python’s specific case, I've seen no alternative that isn't bad for readability; the strong line-orientation of Python's broader syntax limits the good options for inline anonymous functions.
That being said complex lambdas in general can be adverse to maintainability and Python’s single-expression limitation largely prevents that (though you can make hideously complex opaque single-expression lambdas if you try.)