What does "Sparse is better than dense" mean? (Python Zen)

Donn Cave donn at u.washington.edu
Fri Jul 12 13:18:49 EDT 2002


Quoth eddie at holyrood.ed.ac.uk (Eddie Corns):
...
| Basically, when you layout code you need to think about how to convey to the
| reader what's going on.  In constructions like the above I believe it's much
| easier to see that it's only ever looking at the beginning of the line and the
| table like structure makes it easy to map what it finds to what gets done.

You can do what you want, but if you're thinking of other programmers,
please don't do that.

Don't try to come up with nifty ways to convey to the reader what's
going on.  Read the coding standards in PEP 8, and follow them to
the letter.  You can't do better.

I'm not saying the standards were developed by a higher intellect
than yours or are informed by some superior rationale, but they're
inherently better than anything you can do, just because they're
how we're used to reading and writing Python.  There's some latitude
for circumstances, but the most readable code will still be the stuff
that follows the standard.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list