[Python-Dev] Comment on PEP 562 (Module getattr and dir) (original) (raw)
Steven D'Aprano steve at pearwood.info
Sun Nov 19 19:57:05 EST 2017
- Previous message (by thread): [Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)
- Next message (by thread): [Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): [Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)
- Next message (by thread): [Python-Dev] Comment on PEP 562 (Module __getattr__ and __dir__)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]