3 ms·
The Zing of Python (Or the well intentioned but ultimately misguided attempt to enlighten the masses.) Pretty is better than boring. Comprehensions are bette
by Veedrac 9y ago
The Zing of Python
(Or the well intentioned but ultimately misguided attempt to enlighten the masses.)
Pretty is better than boring.
Comprehensions are better than loops.
Short is better than long.
Clever is better than tangled.
Nested is better with line breaks.
Compact is better than meandering.
Appearances matter.
The point of a Python program is to teach people to write better Python programs.
Though if they're Java programmers just try to make them jealous.
Exceptions should never be explicitly checked.
Except StopIteration.
If you don't know how to make it Pythonic, refuse to take the obvious approach.
There should be one-- and preferably only one --Pythonic way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
But it's fine to take ramp it up over time as long as you get there.
If it doesn't make a good blog post, perhaps it doesn't make good code.
If it doesn't make good code, it definitely doesn't make a good blog post.
List comprehensions are one honking great idea -- let's do more of those!