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 examp

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 >

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'

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 tjre...@udel.edu wrote:

Re: Why 'Flat is better than nested'

2012-07-31 Thread Ian Kelly
On Tue, Jul 31, 2012 at 3:28 PM, Ifthikhan Nazeem iftecan2...@gmail.com 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

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 iftecan2...@gmail.com 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

Re: Why flat is better than nested?

2010-11-09 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: In message d4e7f8b9-9526-4bf5-b4d7-e398912eb...@b19g2000prj.googlegroups.com, 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

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 alex23
Gregory Ewing greg.ew...@canterbury.ac.nz 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-08 Thread Lawrence D'Oliveiro
In message d4e7f8b9-9526-4bf5-b4d7-e398912eb...@b19g2000prj.googlegroups.com, 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-08 Thread Rustom Mody
On Oct 26, 12:11 am, kj no.em...@please.post wrote: In mailman.232.1288020268.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: And everyone taking the Zen too seriously should remember that it was written by Tim Peters one night during the commercial breaks between

Re: Why flat is better than nested?

2010-11-06 Thread rustom
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

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 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 some

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-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

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 - and I'm

Re: Why flat is better than nested?

2010-11-01 Thread Lawrence D'Oliveiro
In message mailman.297.1288170848.2218.python-l...@python.org, 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 David
On 27 October 2010 20:58, Robin Becker ro...@reportlab.com 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

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 steve-remove-t...@cybersource.com.au 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

Re: Why flat is better than nested?

2010-10-28 Thread Ben Finney
Steven D'Aprano steve-remove-t...@cybersource.com.au 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,

Re: Why flat is better than nested?

2010-10-28 Thread rantingrick
On Oct 25, 10:23 am, Steve Holden st...@holdenweb.com 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 Andreas Waldenburger
On Wed, 27 Oct 2010 22:47:35 -0700 (PDT) alex23 wuwe...@gmail.com wrote: On Oct 27, 7:58 pm, Robin Becker ro...@reportlab.com 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

Re: Why flat is better than nested?

2010-10-28 Thread alex23
Andreas Waldenburger use...@geekmail.invalid wrote: No, it wouldn't, hence Stefan's (and your) error. It maps to a specific boy. Replacing thats 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

Re: Why flat is better than nested?

2010-10-28 Thread rantingrick
On Oct 27, 8:40 pm, Steven D'Aprano steve-REMOVE- t...@cybersource.com.au 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-

Re: Why flat is better than nested?

2010-10-27 Thread Jorgen Grahn
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 to have a module hierarchy of depth 1 or 2

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 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 Lie Ryan
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

Re: Why flat is better than nested?

2010-10-27 Thread kj
In mailman.278.1288129342.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: On 10/26/2010 2:44 PM, kj wrote: In mailman.258.1288104186.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: The answer is probably the same as you will see if you try from

Re: Why flat is better than nested?

2010-10-27 Thread nn
On Oct 25, 4:18 pm, Ethan Furman et...@stoneleaf.us wrote: kj wrote: In mailman.232.1288020268.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: On Oct 25, 5:07 am, kj no.em...@please.post wrote: In The Zen of Python, one of the maxims is flat is better than nested

Re: Why flat is better than nested?

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

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 lot

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 st...@holdenweb.com 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

Re: Why flat is better than nested?

2010-10-27 Thread alex23
Steven D'Aprano steve-remove-t...@cybersource.com.au 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

Re: Why flat is better than nested?

2010-10-27 Thread alex23
On Oct 27, 7:58 pm, Robin Becker ro...@reportlab.com 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

Re: Why flat is better than nested?

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

Re: Why flat is better than nested?

2010-10-26 Thread Carl Banks
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 to have a module hierarchy of depth 1 or 2 and many top level items, than a depth of 5

Re: Why flat is better than nested?

2010-10-26 Thread kj
In mailman.241.1288036400.2218.python-l...@python.org Terry Reedy tjre...@udel.edu 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

Re: Why flat is better than nested?

2010-10-26 Thread Benjamin Kaplan
On Tue, Oct 26, 2010 at 9:05 AM, kj no.em...@please.post wrote: In mailman.241.1288036400.2218.python-l...@python.org Terry Reedy tjre...@udel.edu 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

Re: Why flat is better than nested?

2010-10-26 Thread Seebs
On 2010-10-26, kj no.em...@please.post 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

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

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 John Nagle
On 10/25/2010 6:34 AM, Alex Willmer wrote: On Oct 25, 11:07 am, kjno.em...@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? I take this as a reference to the layout

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, kjno.em...@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

Re: Why flat is better than nested?

2010-10-26 Thread kj
In mailman.258.1288104186.2218.python-l...@python.org Steve Holden st...@holdenweb.com 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 --

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,

Re: Why flat is better than nested?

2010-10-26 Thread Steve Holden
On 10/26/2010 2:44 PM, kj wrote: In mailman.258.1288104186.2218.python-l...@python.org Steve Holden st...@holdenweb.com 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

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 depends

Re: Why flat is better than nested?

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

Re: Why flat is better than nested?

2010-10-25 Thread bruno.desthuilli...@gmail.com
On 25 oct, 15:34, Alex Willmer a...@moreati.org.uk wrote: On Oct 25, 11:07 am, kj no.em...@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? I take this as a reference

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 Alex Willmer
On Oct 25, 2:56 pm, Robin Becker ro...@reportlab.com 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

Re: Why flat is better than nested?

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

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 no.em...@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

Re: Why flat is better than nested?

2010-10-25 Thread kj
In f8b6c925-ca3b-4be4-8851-6b18c6465...@j18g2000yqd.googlegroups.com rantingrick rantingr...@gmail.com writes: On Oct 25, 5:07=A0am, kj no.em...@please.post 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

Re: Why flat is better than nested?

2010-10-25 Thread kj
In mailman.232.1288020268.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: On 10/25/2010 10:47 AM, rantingrick wrote: On Oct 25, 5:07 am, kj no.em...@please.post 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 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 Steve Holden
On 10/25/2010 3:11 PM, kj wrote: In mailman.232.1288020268.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: On 10/25/2010 10:47 AM, rantingrick wrote: On Oct 25, 5:07 am, kj no.em...@please.post wrote: In The Zen of Python, one of the maxims is flat is better than

Re: Why flat is better than nested?

2010-10-25 Thread Ethan Furman
kj wrote: In mailman.232.1288020268.2218.python-l...@python.org Steve Holden st...@holdenweb.com writes: On Oct 25, 5:07 am, kj no.em...@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

Re: Why flat is better than nested?

2010-10-25 Thread Ben Finney
Steve Holden st...@holdenweb.com 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 ...