A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-January/051213.html below:

[Python-Dev] Re: Zen of Python

[Python-Dev] Re: Zen of Python [Python-Dev] Re: Zen of PythonAlex Martelli aleax at aleax.it
Thu Jan 20 09:09:36 CET 2005
On 2005 Jan 20, at 02:47, Skip Montanaro wrote:

>     Phillip> Actually, this is one of those rare cases where 
> optimization
>     Phillip> and clarity go hand in hand.  Human brains just don't 
> handle
>     Phillip> nesting that well.  It's easy to visualize two levels of 
> nested
>     Phillip> structure, but three is a stretch unless you can abstract 
> at
>     Phillip> least one of the layers.
>
> Also, if you think about nesting in a class/instance context, 
> something like
>
>     self.attr.foo.xyz()
>
> says you are noodling around in the implementation details of 
> self.attr (you
> know it has a data attribute called "foo").  This provides for some 
> very
> tight coupling between the implementation of whatever self.attr is and 
> your
> code.  If there is a reason for you to get at whatever xyz() returns, 
> it's
> probably best to publish a method as part of the api for self.attr.

Good point: this is also known as "Law of Demeter" and relevant 
summaries and links are for example at 
http://www.ccs.neu.edu/home/lieber/LoD.html .


Alex

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4