Why "flat is better than nested"?

Steve Holden steve at holdenweb.com
Mon Oct 25 21:56:47 CEST 2010

On 10/25/2010 3:11 PM, kj wrote:
> In <mailman.232.1288020268.2218.python-list at python.org> Steve Holden <steve at holdenweb.com> writes:
>> On 10/25/2010 10:47 AM, rantingrick wrote:
>>> On Oct 25, 5:07 am, kj <no.em... at please.post> wrote:
>>>> In "The Zen of Python", one of the "maxims" is "flat is better than
>>>> nested"?  Why?  Can anyone give me a concrete example that illustrates
>>>> this point?
>>> Simple. This commandment (endowed by the anointed one, GvR) is
>>> directed directly at lisp and those filthy lispers. If you don't know
>>> what lisp is then Google it. Then try to program with it for one hour.
>>> Very soon after your head will explode from the nested bracket plague
>>> and then you shall be enlightened!
>> And everyone taking the Zen too seriously should remember that it was
>> written by Tim Peters one night during the commercial breaks between
>> rounds of wrestling on television. So while it can give useful guidance,
>> it's nether prescriptive nor a bible ...
> Well, it's pretty *enshrined*, wouldn't you say?  After all, it is
> part of the standard distribution, has an easy-to-remember invocation,
> etc.  *Someone* must have taken it seriously enough to go through
> all this bother.  If it is as trivial as you suggest (and for all
> I know you're absolutely right), then let's knock it off its pedestal
> once and for all, and remove it from the standard distribution.
I don't know who decided to put the "this" module into Python as an
Easter egg. But don't think you can suppress it now. Trying to do so
would only bring out people's inherent religious fervor and cause an
outcry you would regret.

Besides which I am sure Tim Peters derives a lot of harmless fun from
seeing people take it so seriously.

Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/

More information about the Python-list mailing list