I'm a fairly strong Python coder, but too much of my style is a little haphazard, and I'm sure there are more Pythonic solutions to many problems than the ones I come up with. Which PEPs are essential for any well versed Pythonista to read?
Use a heavy dose of common sense when reading it. Ignore the section about "79 characters" entirely; it's braindamaged and leads to ugly, hard-to-read code for no real-world benefit (this was written in 2001 and sane development systems weren't 80x25 even then). The horrors of the "Rectangle" example show the problem very clearly.
Glenn Maynard
2009-09-05 08:00:47
Despite of my 22" screen, all my editor/terminal windows are fixed to 80 chars and I try to write the code accordingly. (But, as Terry Pratchett puts it, rules are to make you think before breaking them.)
bayer
2009-09-05 08:22:51
+1 for PEP8. I also try my best to keep it at 80.
fengshaun
2009-09-05 22:27:01
+4
A:
I found that reading the declined ones can give some good insights into what's Pythonic and what isn't. This was a while ago so I don't have any specific examples.
Greg
2009-09-05 06:53:07
+4
A:
It is now retrospective, but still interesting: I think Things that will Not Change in Python 3000 is a good read, with lots of links to the discussions that preceded the decisions.
kaizer.se
2009-09-05 10:34:42
+4
A:
Although Python is incredibly intuitive, a lot of people do not comprehend his philosophy.
Pep 20: The Zen of Python
- Beautiful is better than ugly.
- Explicit is better than implicit.
- Simple is better than complex.
- Complex is better than complicated.
- Flat is better than nested.
- Sparse is better than dense.
- Readability counts.
- Special cases aren't special enough to break the rules.
- Although practicality beats purity.
- Errors should never pass silently.
- Unless explicitly silenced.
- In the face of ambiguity, refuse the temptation to guess.
- There should be one-- and preferably only one --obvious way to do it.
- Although that way may not be obvious at first unless you're Dutch.
- Now is better than never.
- Although never is often better than right now.
- If the implementation is hard to explain, it's a bad idea.
- If the implementation is easy to explain, it may be a good idea.
- Namespaces are one honking great idea -- let's do more of those!
Paolo Moretti
2009-09-05 15:59:54