Eric Snow <ericsnowcurren...@gmail.com> added the comment:

+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?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33277>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to