Re: Why "flat is better than nested"?

2017-12-22 Thread Steve D'Aprano
On Sat, 23 Dec 2017 01:48 am, andrewpat...@gmail.com wrote: > On Monday, October 25, 2010 at 11:07:42 AM UTC+1, kj 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? >> >> TIA! >>

Re: Why "flat is better than nested"?

2017-12-22 Thread andrewpate08
On Monday, October 25, 2010 at 11:07:42 AM UTC+1, kj 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? > > TIA! > > ~kj > > PS: My question should not be construed as a defense for "

Re: Why 'Flat is better than nested'

2012-07-31 Thread Terry Reedy
On 7/31/2012 5:49 PM, Ian Kelly wrote: On Tue, Jul 31, 2012 at 3:28 PM, Ifthikhan Nazeem wrote: as many as (about) 2*N - log2(N) parent child relationships I would like to know how did you come up with the above formula? Forgive my ignorance. By non-rigorous experimentation, which did not qu

Re: Why 'Flat is better than nested'

2012-07-31 Thread Ian Kelly
On Tue, Jul 31, 2012 at 3:28 PM, Ifthikhan Nazeem wrote: > as many as (about) 2*N - log2(N) parent child relationships > > I would like to know how did you come up with the above formula? Forgive my > ignorance. I come up with 2N - 2 myself. If there are N leaf nodes and N - 1 non-leaf nodes, th

Re: Why 'Flat is better than nested'

2012-07-31 Thread Ifthikhan Nazeem
*as many as (about) 2*N - log2(N) parent child relationships* * * I would like to know how did you come up with the above formula? Forgive my ignorance. -- Thanks and Best Regards, Iftikhan Nazeem *Skype* : iftecan2000 On Tue, Jul 31, 2012 at 11:04 PM, Terry Reedy wrote: > >>> import this > >

Why 'Flat is better than nested'

2012-07-31 Thread Terry Reedy
>>> import this prints 'The Zen of Python', a poem by Tim Peters that consists of python proverbs such as "Flat is better than nested." (Others things being equal) why? Because it is a restatement of the principle of parsimony, of not multiplying entities without necessity. Suppose we have a

Re: Why "flat is better than nested"?

2010-11-09 Thread alex23
Gregory Ewing wrote: > I get it. Does that mean that I don't get it? Mu. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-11-09 Thread John Posner
On 11/9/2010 3:44 PM, Gregory Ewing wrote: I don’t get it. I get it. Does that mean that I don't get it? Yes. As Dr. Feynman said about quantum mechanics. -John -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-11-09 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: In message , rustom wrote: If you take zen seriously you dont get it If you dont take zen seriously you dont get it That -- seriously -- is zen I don’t get it. I get it. Does that mean that I don't get it? -- Greg -- http://mail.python.org/mailman/listinfo/pyth

Re: Why "flat is better than nested"?

2010-11-08 Thread Rustom Mody
On Oct 26, 12:11 am, kj wrote: > In Steve Holden > writes: > > > > >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 n

Re: Why "flat is better than nested"?

2010-11-08 Thread Lawrence D'Oliveiro
In message , rustom wrote: > If you take zen seriously you dont get it > If you dont take zen seriously you dont get it > That -- seriously -- is zen I don’t get it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-11-06 Thread rustom
On Nov 6, 2:52 pm, Peter Otten <__pete...@web.de> wrote: > rustom wrote: > > If you take zen seriously you dont get it > > If you dont take zen seriously you dont get it > > You forgot: > > If you explain zen you don't get it I guess different communities have different settings for 'explanation-

Re: Why "flat is better than nested"?

2010-11-06 Thread J. Gerlach
Am 06.11.2010 02:36, schrieb Steven D'Aprano: > On Fri, 05 Nov 2010 14:19:47 +0100, J. Gerlach wrote: > >> Am 28.10.2010 03:40, schrieb Steven D'Aprano: >>> [ snip a lot of wise words ] >> >> Can I put this (translated) in the german python wiki? I guess it might >> help more people to understand

Re: Why "flat is better than nested"?

2010-11-06 Thread Peter Otten
rustom wrote: > If you take zen seriously you dont get it > If you dont take zen seriously you dont get it You forgot: If you explain zen you don't get it -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-11-06 Thread rustom
On Oct 26, 12:11 am, kj wrote: > In Steve Holden > writes: > > > > >On 10/25/2010 10:47 AM, rantingrick wrote: > >> On Oct 25, 5:07 am, kj 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 illustrat

Re: Why "flat is better than nested"?

2010-11-05 Thread Steven D'Aprano
On Fri, 05 Nov 2010 14:19:47 +0100, J. Gerlach wrote: > Am 28.10.2010 03:40, schrieb Steven D'Aprano: >> [ snip a lot of wise words ] > > Can I put this (translated) in the german python wiki? I guess it might > help more people to understand some decisions taken during python's > development - a

Re: Why "flat is better than nested"?

2010-11-05 Thread J. Gerlach
Am 28.10.2010 03:40, schrieb Steven D'Aprano: > [ snip a lot of wise words ] Can I put this (translated) in the german python wiki? I guess it might help more people to understand some decisions taken during python's development - and I'm to lazy to do something similar myself ;) Greetings from B

Re: Why "flat is better than nested"?

2010-11-01 Thread Lawrence D'Oliveiro
In message , Stefan Behnel wrote: > What's a "that boy"? A boy who’s the opposite of fin. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-28 Thread rantingrick
On Oct 27, 8:40 pm, Steven D'Aprano wrote: > Although the Zen is written in a light-hearted fashion, it is not > intended as a joke. Every line in the Zen is genuine advice -- even the > one about being Dutch. Would it help to write it out in a less light- > hearted fashion? > > When programming

Re: Why "flat is better than nested"?

2010-10-28 Thread alex23
Andreas Waldenburger wrote: > No, it wouldn't, hence Stefan's (and your) error. It maps to a specific > boy. Replacing "that"s where possible, it becomes: > > I know that [the] "that" [which] that boy said is wrong. Ah, I see now: I know that that "that" that _that_ boy said is wrong :) -- http:

Re: Why "flat is better than nested"?

2010-10-28 Thread Andreas Waldenburger
On Wed, 27 Oct 2010 22:47:35 -0700 (PDT) alex23 wrote: > On Oct 27, 7:58 pm, Robin Becker wrote: > > >> "I know that that that that that boy said is wrong!". > > > > well they say nested is hard. How about this break down > > > > I know that X that a boy said is wrong. (any boy) > > I know that

Re: Why "flat is better than nested"?

2010-10-28 Thread rantingrick
On Oct 25, 10:23 am, Steve Holden wrote: > it was > written by Tim Peters one night during the commercial breaks between > rounds of wrestling on television. Tim Peters...a "WrestleMania" fan...who would have guessed? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-28 Thread Ben Finney
Steven D'Aprano writes: > On Wed, 27 Oct 2010 22:45:21 -0700, alex23 wrote: > > The whole thing could be replaced by a single print """The Zen > > of...""". > > But that would miss the point. It's supposed to be light-hearted. Yes, and to that end it's also (deliberately, in my view) breaking as

Re: Why "flat is better than nested"?

2010-10-28 Thread Steven D'Aprano
On Wed, 27 Oct 2010 22:45:21 -0700, alex23 wrote: > Steven D'Aprano wrote: >> > Load the source code for the ‘this’ module into a text editor, and >> > see how many of the maxims it violates. >> >> None of them. > > I'd say it easily violates the first 3, being neither beautiful, > explicit nor

Re: Why "flat is better than nested"?

2010-10-27 Thread David
On 27 October 2010 20:58, Robin Becker wrote: > On 27/10/2010 10:13, Stefan Behnel wrote: >> Robin Becker, 25.10.2010 15:56: >>> >>> "I know that that that that that boy said is wrong!". >> >> What's a "that boy"? >> > well they say nested is hard. How about this break down [...] How about this b

Re: Why "flat is better than nested"?

2010-10-27 Thread alex23
On Oct 27, 7:58 pm, Robin Becker wrote: > >> "I know that that that that that boy said is wrong!". > > well they say nested is hard. How about this break down > > I know that X that a boy said is wrong. (any boy) > I know that X that the boy said is wrong. (a single boy) > I know that X that that

Re: Why "flat is better than nested"?

2010-10-27 Thread alex23
Steven D'Aprano wrote: > > Load the source code for the ‘this’ module into a text editor, and see > > how many of the maxims it violates. > > None of them. I'd say it easily violates the first 3, being neither beautiful, explicit nor simple, and especially "Readability counts". The whole thing c

Re: Why "flat is better than nested"?

2010-10-27 Thread Steven D'Aprano
On Tue, 26 Oct 2010 08:02:19 +1100, Ben Finney wrote: > Steve Holden writes: > >> 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 >> gui

Re: Why "flat is better than nested"?

2010-10-27 Thread Steven D'Aprano
On Wed, 27 Oct 2010 14:02:27 +, kj wrote: > I have nothing against humor. The reason why I find "import braces" > funny is that it is so obviously a joke. But I do find it mildly > annoying (and just mildly) that a joke/hoax/farce like ZoP/this.py is > built into the standard lib, because a

Re: Why "flat is better than nested"?

2010-10-27 Thread Raymond Hettinger
On Oct 25, 8:23 am, Steve Holden wrote: > 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 .

Re: Why "flat is better than nested"?

2010-10-27 Thread nn
On Oct 25, 4:18 pm, Ethan Furman wrote: > kj wrote: > > In Steve Holden > > writes: > > >>> On Oct 25, 5:07 am, kj 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?

Re: Why "flat is better than nested"?

2010-10-27 Thread kj
In Steve Holden writes: >On 10/26/2010 2:44 PM, kj wrote: >> In Steve Holden >> writes: >> >>> The answer is probably the same as you will see if you try >> >>> from __future__ import braces >> >>> That feature *is* available in Python 2.6 ;-) >> >> Now, that's hilarious. >> >See, ther

Re: Why "flat is better than nested"?

2010-10-27 Thread Lie Ryan
On 10/26/10 06:56, Steve Holden wrote: > On 10/25/2010 3:11 PM, kj wrote: >> In Steve Holden >> writes: >> >>> On 10/25/2010 10:47 AM, rantingrick wrote: On Oct 25, 5:07 am, kj wrote: > In "The Zen of Python", one of the "maxims" is "flat is better than > nested"? Why? Can anyone

Re: Why "flat is better than nested"?

2010-10-27 Thread Robin Becker
On 27/10/2010 10:13, Stefan Behnel wrote: Robin Becker, 25.10.2010 15:56: "I know that that that that that boy said is wrong!". What's a "that boy"? Stefan well they say nested is hard. How about this break down I know that X that a boy said is wrong. (any boy) I know that X that the boy

Re: Why "flat is better than nested"?

2010-10-27 Thread Stefan Behnel
Robin Becker, 25.10.2010 15:56: "I know that that that that that boy said is wrong!". What's a "that boy"? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-27 Thread Jorgen Grahn
On Tue, 2010-10-26, Carl Banks wrote: > On Oct 25, 11:20 pm, Jorgen Grahn wrote: >> On Mon, 2010-10-25, bruno.desthuilli...@gmail.com wrote: >> > On 25 oct, 15:34, Alex Willmer wrote: >> >> On Oct 25, 11:07 am, kj wrote: >> >> >> > In "The Zen of Python", one of the "maxims" is "flat is better t

Re: Why "flat is better than nested"?

2010-10-26 Thread Steve Holden
On 10/26/2010 2:44 PM, kj wrote: > In Steve Holden > writes: > >> The answer is probably the same as you will see if you try > >> from __future__ import braces > >> That feature *is* available in Python 2.6 ;-) > > Now, that's hilarious. > See, there *is* a place for humor :) regards Ste

Re: Why "flat is better than nested"?

2010-10-26 Thread Ian
On 26/10/2010 14:18, Benjamin Kaplan wrote: This is a programming language named after a British comedy group (not the snake). There are going to be jokes inserted in lots of otherwise serious things. Like the standard library. Please, lets NOT get a newsgroup cross feed! I don't want spam, spa

Re: Why "flat is better than nested"?

2010-10-26 Thread kj
In Steve Holden writes: >The answer is probably the same as you will see if you try > from __future__ import braces >That feature *is* available in Python 2.6 ;-) Now, that's hilarious. kj -- http://mail.python.org/mailman/listinfo/python-list

Re: Why "flat is better than nested"?

2010-10-26 Thread Albert Hopkins
On Tue, 2010-10-26 at 09:45 -0700, John Nagle wrote: > On 10/25/2010 6:34 AM, Alex Willmer wrote: > > On Oct 25, 11:07 am, kj 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?

Re: Why "flat is better than nested"?

2010-10-26 Thread John Nagle
On 10/25/2010 6:34 AM, Alex Willmer wrote: On Oct 25, 11:07 am, kj 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? I take this as a reference to the layout of the Python standard libr

Re: Why "flat is better than nested"?

2010-10-26 Thread Robin Becker
On 26/10/2010 15:42, Steve Holden wrote: he answer is probably the same as you will see if you try from __future__ import braces That feature*is* available in Python 2.6;-) In the past I used to think it was really cool that one could do from __future__ import exciting_and_cool_new_stuff

Re: Why "flat is better than nested"?

2010-10-26 Thread Steve Holden
On 10/26/2010 9:05 AM, kj wrote: > Perhaps the disconnect here is that you're seeing the whole thing > from an insider's point of view, while I'm still enough of an > outsider not to share this point of view. (I happen to think that > one the hallmarks of being an initiate to a discipline is an al

Re: Why "flat is better than nested"?

2010-10-26 Thread Seebs
On 2010-10-26, kj wrote: > (Though, humorless as it is of me, I still would prefer the ZoP > out of the standard library, to save myself having to tell those > who are even newer to Python than me not to take it seriously.) Well, not to take it *too* seriously. It's like any other Zen -- it's wo

Re: Why "flat is better than nested"?

2010-10-26 Thread Benjamin Kaplan
On Tue, Oct 26, 2010 at 9:05 AM, kj wrote: > In Terry Reedy > writes: > >>On 10/25/2010 3:11 PM, kj wrote: > >>> Well, it's pretty *enshrined*, wouldn't you say? > >>No. > >> >  After all, it is part of the standard distribution, > >>So is 'import antigravity' > > Are you playing with my feelin

Re: Why "flat is better than nested"?

2010-10-26 Thread kj
In Terry Reedy writes: >On 10/25/2010 3:11 PM, kj wrote: >> Well, it's pretty *enshrined*, wouldn't you say? >No. > > After all, it is part of the standard distribution, >So is 'import antigravity' Are you playing with my feelings? % python Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29

Re: Why "flat is better than nested"?

2010-10-26 Thread Carl Banks
On Oct 25, 11:20 pm, Jorgen Grahn wrote: > On Mon, 2010-10-25, bruno.desthuilli...@gmail.com wrote: > > On 25 oct, 15:34, Alex Willmer wrote: > >> On Oct 25, 11:07 am, kj wrote: > > >> > In "The Zen of Python", one of the "maxims" is "flat is better than > >> > nested"?  Why?  Can anyone give me

Re: Why "flat is better than nested"?

2010-10-25 Thread Jorgen Grahn
On Mon, 2010-10-25, bruno.desthuilli...@gmail.com wrote: > On 25 oct, 15:34, Alex Willmer wrote: >> On Oct 25, 11:07 am, kj 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 poin

Re: Why "flat is better than nested"?

2010-10-25 Thread Ben Finney
Steve Holden writes: > 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 ... Even to those

Re: Why "flat is better than nested"?

2010-10-25 Thread Ethan Furman
kj wrote: In Steve Holden writes: On Oct 25, 5:07 am, kj 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? Two points on the practical side: most folk only remember a few levels

Re: Why "flat is better than nested"?

2010-10-25 Thread Steve Holden
On 10/25/2010 3:11 PM, kj wrote: > In Steve Holden > writes: > >> On 10/25/2010 10:47 AM, rantingrick wrote: >>> On Oct 25, 5:07 am, kj 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 >>

Re: Why "flat is better than nested"?

2010-10-25 Thread Terry Reedy
On 10/25/2010 3:11 PM, kj wrote: Well, it's pretty *enshrined*, wouldn't you say? No. > After all, it is part of the standard distribution, So is 'import antigravity' > has an easy-to-remember invocation, etc. *Someone* must have taken it seriously enough to go through all this bother.

Re: Why "flat is better than nested"?

2010-10-25 Thread kj
In Steve Holden writes: >On 10/25/2010 10:47 AM, rantingrick wrote: >> On Oct 25, 5:07 am, kj 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 commandmen

Re: Why "flat is better than nested"?

2010-10-25 Thread kj
In rantingrick writes: >On Oct 25, 5:07=A0am, kj wrote: >> In "The Zen of Python", one of the "maxims" is "flat is better than >> nested"? =A0Why? =A0Can anyone give me a concrete example that illustrate= >s >> this point? >Simple. This commandment (endowed by the anointed one, GvR) is >direc

Re: Why "flat is better than nested"?

2010-10-25 Thread Steve Holden
On 10/25/2010 10:47 AM, rantingrick wrote: > On Oct 25, 5:07 am, kj 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

Re: Why "flat is better than nested"?

2010-10-25 Thread rantingrick
On Oct 25, 5:07 am, kj 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 lisp

Re: Why "flat is better than nested"?

2010-10-25 Thread Alex Willmer
On Oct 25, 2:56 pm, Robin Becker wrote: > On 25/10/2010 11:07, kj 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? > > ... > I believe that the following illustrates the n

Re: Why "flat is better than nested"?

2010-10-25 Thread Robin Becker
On 25/10/2010 11:07, kj 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? ... I believe that the following illustrates the nesting issue (I think this is from somewhere in Chomsky)

Re: Why "flat is better than nested"?

2010-10-25 Thread bruno.desthuilli...@gmail.com
On 25 oct, 15:34, Alex Willmer wrote: > On Oct 25, 11:07 am, kj 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? > > I take this as a reference to the layout of the Python st

Re: Why "flat is better than nested"?

2010-10-25 Thread Alex Willmer
On Oct 25, 11:07 am, kj 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? I take this as a reference to the layout of the Python standard library and other packages i.e. it's better t

Why "flat is better than nested"?

2010-10-25 Thread kj
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? TIA! ~kj PS: My question should not be construed as a defense for "nested". I have no particular preference for either flat or nested; it all d