3 ms·
As someone who's written in a few languages and is now learning/writing Python full time, "pythonic" is starting to cause me a twitch of pain every time I read
by zimablue 10y ago
As someone who's written in a few languages and is now learning/writing Python full time, "pythonic" is starting to cause me a twitch of pain every time I read it.
It seems to imply the Python has the final solution in how to write code and therefore everything should be written in the way that Python elders have decided.
Main example: I don't really like list comprehensions. They're pretty much the same thing as map/filter but less understandable or composable, nevermind you fix (with your choice of brackets in multiple places) your choice of list vs generator vs "pushing source" (not sure the right word) which you wouldn't have to with transducers.
http://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python http://stackoverflow.com/questions/952914/making-a-flat-list...
I'd rather read code where someone wrote "flatten".
- terminalcommand 10y agoIMHO pythonic means that you adhere with the principle "there should be one --and preferably only one -- obvious way to do it". And that one way is set out by the BDFL Guido :). I have theory that, python was introduced out of frustration with Perl. As we all know, Perl had the principle of TIMTOWTDI. Another far more tangential and biased theory here: As Python imposes strict programming principles, it resembles Java in forcing the programmer to abide by the styles set out by the language designers. And maybe that's why schools prefer to teach Python instead of Ruby as a scripting language. PS: I have nothing against Java and I love Python. My theory is based upon Guido's insistence on not opening the language fully to functional programming. I'd like to see better lambdas, functional programming without itertools etc. But I know Guido has his reasons, pythonic code uses list comprehensions instead of FP.