You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement PEP 562: module __getattr__ and __dir__ #76406
That can then cover defining __getattr__ and __dir__ as module level functions, and also mention setting __class__ (which would be enough to close bpo-27505 as well).
The new section should explicitly mention that these only affect lookups and modifications made using the attribute access syntax - directly accessing the module globals (whether by code within the module, or via a reference to the module's globals dict) is unaffected.
Activity
ncoghlan commentedon Dec 10, 2017
For documentation of this feature, I'd suggest adding a new subsection after https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access (but at the same level), called "Customizing module attribute access".
That can then cover defining __getattr__ and __dir__ as module level functions, and also mention setting __class__ (which would be enough to close bpo-27505 as well).
The new section should explicitly mention that these only affect lookups and modifications made using the attribute access syntax - directly accessing the module globals (whether by code within the module, or via a reference to the module's globals dict) is unaffected.
ilevkivskyi commentedon Dec 14, 2017
New changeset 5364b5c by Ivan Levkivskyi in branch 'master':
bpo-32225: Implementation of PEP-562 (bpo-4731)
5364b5c
ilevkivskyi commentedon Dec 14, 2017
Travis build on master successful, so I am closing this issue.
methane commentedon Jan 19, 2018
I didn't notice this is implemented.
Congrats, Ivan!
BTW, would you update the PEP status to Final?
ilevkivskyi commentedon Jan 20, 2018
Good point, here is the PR python/peps#554