| Store | Cart

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

From: Peter Hansen <pet...@engcorp.com>
Thu, 11 Jul 2002 08:24:28 -0400
Miki Tebeka wrote:
> > Hello All,> > Although it's in the Humor section I take the Python Zen> (http://www.python.org/doc/Humor.html#zen) quite seriously.> However I can understand what does “Sparse is better than> dense” means.

It (means don't write):
  your-code=like+this; because(no,one)
  will,be,able=to-read(what,you,are,writing+without-effort)

Instead, use lots of white space.

Put empty lines between blocks of unrelated code within functions,
put spaces around operators much of the time (except for the "="
in default/named arguments like the above).

Put two lines between method or function definitions.  

Let the air into the code so it can breathe.  Code that is too
dense starves for air and withers and dies.

At least, that's my interpretation. :)

-Peter

Recent Messages in this Thread
Miki Tebeka Jul 11, 2002 11:28 am
Peter Hansen Jul 11, 2002 12:24 pm
Mark McEahern Jul 11, 2002 01:07 pm
Aahz Jul 11, 2002 06:35 pm
Mike C. Fletcher Jul 11, 2002 08:23 pm
Andrae Muys Jul 11, 2002 11:30 pm
jep...@unpythonic.net Jul 11, 2002 11:45 pm
Peter Hansen Jul 12, 2002 03:31 am
Ian Bicking Jul 12, 2002 08:00 am
Tim Peters Jul 12, 2002 08:22 am
Bernhard Herzog Jul 12, 2002 07:09 pm
Peter Hansen Jul 12, 2002 08:27 am
Messages in this thread