Why 'Flat is better than nested'

Ifthikhan Nazeem iftecan2000 at gmail.com
Tue Jul 31 17:28:03 EDT 2012


*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 <tjreedy at udel.edu> wrote:

> >>> 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 unstructured collection of N items. Organizer comes
> along and says 'Let there be structure. Let us organize the items as leaf
> nodes in a hierarchical tree' (which is equivalent to nesting). To do so,
> we can add as many as N-1 new non-leaf nodes and as many as (about) 2*N -
> log2(N) parent child relationships. In other words, nearly quadruple the
> number of entities to learn, discuss, and remember. Well, there had better
> be a good necessity to do so ;-).
>
> And, of course, once new entities *are* conjured up, it is hard to get rid
> of them.
>
> --
> Terry Jan Reedy
>
>
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120731/2f05c926/attachment.html>


More information about the Python-list mailing list