3 ms·
IMO arbitrary rules like lambda expressions being limited to one expression do not directly improve readability and maintainability. Consistently using good con
by creatonez 9y ago
IMO arbitrary rules like lambda expressions being limited to one expression do not directly improve readability and maintainability. Consistently using good conventions in the first place will help you more than arbitrary restrictions.
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.
- dragonwriter 9y ago> IMO arbitrary rules like lambda expressions being limited to one expression do not directly improve readability and maintainability. 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.)