3 ms·
> There's also the case of some of those potential features threatening to go against the Zen of Python It seems like "Zen of Python" is applied inconsistently
by weberc2 9y ago
> There's also the case of some of those potential features threatening to go against the Zen of Python
It seems like "Zen of Python" is applied inconsistently, especially the "one way to do it" rule. Python is horrid about "one way to do it"--list comprehensions vs loops, decorator syntax vs `x = decorate(x)`, try/except/finally vs with, etc etc. In particular, if we are going to force a choice between iterative and recursive based on "one way to do it", then I would vote recursion + tco. Of course, this is a false dichotomy and we could have the best of both worlds.
> if you are going to require high-performance * , or things that collide with the Global Interpreter Lock, etc, then simply Python is not the best choice.
Unfortunately, people rarely realize their performance requirements until they're neck-deep in Python. Basically if you ever, ever, ever think you might need decent performance, there are performant languages that beat Python at its own friendliness/maintainability game (Go comes to mind).
- nerdponx 9y agoIt seems like "Zen of Python" is applied inconsistently Good. I think we would all be better off if we forgot about it entirely.
- scardine 9y agoI don't see a conflict between loops, list comprehensions and other shortcuts - use the syntax sugar where it makes the code simpler/easier to read, otherwise stick to plain loops. My own rules for "list/dict comprehension" versus "loops" versus "generator expressions" are the following: * use a loop where you are interested only in the side-effects or where it will make the code easier to read * use generator expressions where you don't really need to instantiate a list, for example when you are just iterating over the result and throwing it away. * use list or dict comprehensions where you need to build and save a list/dict and the resulting code does not resemble a lisp program (where the choice does not make the program harder to read).
- weberc2 9y agoI agree, but it's nevertheless a violation of the "one obvious way" rule.