Q: What does "Sparse is better than dense" mean? (Python Zen)
Aahz
aahz at pythoncraft.com
Thu Jul 11 14:35:40 EDT 2002
In article <33803989.0207110328.5ef01f1e at posting.google.com>,
Miki Tebeka <tebeka at cs.bgu.ac.il> 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.
Here's a better example than the one Peter gave:
if i>0: return sqrt(i)
elif i==0: return 0
else: return 1j * sqrt(-i)
versus
if i>0:
return sqrt(i)
elif i==0:
return 0
else:
return 1j * sqrt(-i)
To rephrase the dictum another way, "Don't try to stick too much code on
one line."
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Project Vote Smart: http://www.vote-smart.org/
More information about the Python-list
mailing list