On Thu, 2002-07-11 at 06:28, Miki Tebeka wrote:
> 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.
Tim hasn't chimed in yet -- I bet he's letting us make our own wild
speculations, so that we may attain greater wisdom through pondering :)
Or maybe his attention is just elsewhere... but I'd like to think that
this is a Zen koan.
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
Kind of the opposite of Perl is Lisp languages, but these have a certain
density as well -- they pack all meanings into a single syntax. E.g.:
(define (reverse x)
(if (null? x) '() (append (reverse (cdr x)) (list (car x)))))
Doing a binding -- using "define" -- looks a lot like a control
structure -- using "if" -- and that looks a lot like a condition --
using "null?" -- or a function call -- using "car" -- and the return is
implicit in the expression itself. One syntactic notion -- the
space-seperated nested list -- is used to do absolutely everything.
Python, while not nearly as regular, has an eclectic nature to the
syntax that makes different concepts easier to distinguish from each
I'm probably reading more into this little statement than is there. But
to me this makes sense in thinking about interfaces and other parts of
programming -- being too eclectic or too consistent both serve to pack
too much meaning into too little space. So for instance, I don't use
the dictionary interface for every mapping-like situation. But I also
don't think it should never be used.