2 ms·
Yeah, the Python language favors an imperative style due to the absence of features necessary for writing more functionally, like lambdas that can do more than
by fantod 6y ago
Yeah, the Python language favors an imperative style due to the absence of features necessary for writing more functionally, like lambdas that can do more than return an expression, tail call optimization, and lexical scope. This last one, additionally, tends to make people use classes for essentially no other reason than that closures don't work natively.
> My favorite example is: ','.join(['a', 'b'])
I've always found the discrepancy between this example (instance method call), list(('a', 'b')) (technically a method call, but resembles a functional call), and str.lower('AB') (class method call) to be quite maddening.
- NoThisIsMe 6y agoClosures do work natively in Python though. Lexical scope does not prevent that. Most languages, including functional languages, use lexical scope these days.