| Store | Cart

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

From: Peter Hansen <pet...@engcorp.com>
Fri, 12 Jul 2002 04:27:29 -0400
Ian Bicking wrote:
> > Unlike most of the other people in this thread, I always thought of> sparse v. dense as a syntactic/semantic issue.> > For instance, I think Perl is a very syntactically dense language.  If> you change one character, you'll probably end up with a valid -- and> different -- piece of code.  Every meaning is being squeezed out of the> available combinations of characters.  This is really coming out with> Perl 6 too, it seems.> > Python isn't like that at all -- there's a lot of punctuation that isn't> even used.  There's also a fair amount of redundancy -- for instance, a> colon introduces a block, even though the block explains itself through> its indentation.

Good call.  I think you must be right about that, relative to the less
useful whitespace issue.  Of course, "right" doesn't apply here -- I just
mean your approach is ultimately more useful than one applying only
to ASCII 0x20...

In a trivial way, this also expresses the rationale behind longer
but more descriptive and pronouncable variable names, relative to
the Hungarian notation-inspired and -sired abominations that we still
sometimes see (but more rarely in Python I think).

-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
Previous post: A better self