Message404475
+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? |
|
Date |
User |
Action |
Args |
2021-10-20 15:28:20 | eric.snow | set | recipients:
+ eric.snow, barry, brett.cannon, rhettinger, ncoghlan, pitrou, pmpp, FFY00, iritkatriel |
2021-10-20 15:28:20 | eric.snow | set | messageid: <1634743700.56.0.0230444450409.issue33277@roundup.psfhosted.org> |
2021-10-20 15:28:20 | eric.snow | link | issue33277 messages |
2021-10-20 15:28:20 | eric.snow | create | |
|