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/2017-November/150645.html below:

[Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)

[Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__) [Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)Steven D'Aprano steve at pearwood.info
Sun Nov 19 19:57:05 EST 2017
On Sun, Nov 19, 2017 at 08:24:00PM +0000, Mark Shannon wrote:
> Hi,
> 
> Just one comment. Could the new behaviour of attribute lookup on a 
> module be spelled out more explicitly please?
> 
> 
> I'm guessing it is now something like:
> 
> `module.__getattribute__` is now equivalent to:
> 
> def __getattribute__(mod, name):
>     try:
>         return object.__getattribute__(mod, name)
>     except AttributeError:
>         try:
>             getter = mod.__dict__["__getattr__"]

A minor point: this should(?) be written in terms of the public 
interface for accessing namespaces, namely:

              getter = vars(mod)["__getattr__"]



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