3 ms·
My least favourite part of python (I'm overwhelmingly a fan, and it's probably my favourite language after Clojure) is the deliberately limited functional parts
by pbiggar 14y ago
My least favourite part of python (I'm overwhelmingly a fan, and it's probably my favourite language after Clojure) is the deliberately limited functional parts. Take list comprehensions, they work for simple things, but when you want to make it more complex, it wont let you break it over multiple lines, so you have to rewrite it into a for loop. Makes debugging awkward.
- masklinn 14y ago> it wont let you break it over multiple lines ? result = [ (value, process(value), process(key, value)) for key in generator for value in generate(key) if some_condition(key) if other_condition(value) ] or did you mean something completely different? Maybe the problem of not being able to use statements in comprehensions (or lambdas)?
- pbiggar 14y agoRight, I meant using statements, sorry. It's been quite a few months since I wrote python, so I think I've forgotten most of the details.
- Daniel_Newby 14y agoJust define a nested function above and call it in the list comprehension.
- pbiggar 14y agoSame problem - I have to rewrite my lovely list comprehension instead of just adding a statement to the body.