Message307935
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 issue 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. |
|
Date |
User |
Action |
Args |
2017-12-10 00:39:16 | ncoghlan | set | recipients:
+ ncoghlan, levkivskyi |
2017-12-10 00:39:16 | ncoghlan | set | messageid: <1512866356.6.0.213398074469.issue32225@psf.upfronthosting.co.za> |
2017-12-10 00:39:16 | ncoghlan | link | issue32225 messages |
2017-12-10 00:39:16 | ncoghlan | create | |
|