Brett Cannon added the comment:

So I am going to disagree with Nick about the module attributes and their 
usefulness (partially because I just made __spec__.parent take precedence over 
__package__ in issue #25791). While I get the idea of wanting a history of what 
did (not) change since import, keeping the duplicate information around is 
annoying. And I don't know how truly useful it is to know what things were 
compared to what they became.

If we shift to preferring specs compared to module attributes we can then begin 
to clean up __import__ itself by no longer grabbing the globals() and locals() 
and instead simply pass in the module's __spec__ object. It also simplifies the 
documentation such that we don't have to explain everything twice. If people 
really want to track what a value was relating to import before mutation they 
can simply store it themselves instead of making us do the bookkeeping for 
them. It would also make things such as module_from_spec() or 
loader.create_module() simpler since they only have to worry about setting 
__spec__ instead of that attribute plus a bunch of other ones.

----------
priority: normal -> low
versions: +Python 3.6 -Python 3.4, Python 3.5

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

Reply via email to