This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients FFY00, barry, brett.cannon, eric.snow, iritkatriel, ncoghlan, pitrou, pmpp, rhettinger
Date 2021-10-20.15:28:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634743700.56.0.0230444450409.issue33277@roundup.psfhosted.org>
In-reply-to
Content
+1 on a proxy (with read-only attrs) for everything but __name__, __file__, and __path__ (which can all be different than the spec).  Ideally __name__ and __file__ would be read-only too but they'd have to be stored somewhere other than the spec (e.g. on the proxy or module object).  __path__ could be similarly proxied but would at the least have to be mutable.

The nice thing about such attrs is they wouldn't show up in the module's __dict__, assuming they are properties.

The only catch I see is where the module's code sets one of the attrs.  Would the proxy (or import machinery) pick those up, or maybe for some of them emit a warning or fail?

We could also skip the proxy and add the properties to ModuleType directly, no?
History
Date User Action Args
2021-10-20 15:28:20eric.snowsetrecipients: + eric.snow, barry, brett.cannon, rhettinger, ncoghlan, pitrou, pmpp, FFY00, iritkatriel
2021-10-20 15:28:20eric.snowsetmessageid: <1634743700.56.0.0230444450409.issue33277@roundup.psfhosted.org>
2021-10-20 15:28:20eric.snowlinkissue33277 messages
2021-10-20 15:28:20eric.snowcreate