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 brett.cannon
Recipients brett.cannon, eric.snow
Date 2018-04-13.21:48:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523656102.14.0.682650639539.issue33277@psf.upfronthosting.co.za>
In-reply-to
Content
If you look at https://docs.python.org/3/reference/import.html#import-related-module-attributes you will notice there are a lot of attributes on modules. But since the introduction of module specs (https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec), all of those attributes became redundant.

Now some attributes can never be taken away based on common idioms in the Python community. __name__ can't go due to `if __name__ == '__main__'`. __path__ can't go due to people manipulating it with e.g. pkg_resources or pkgutil. The rest, though, don't have such strong idioms tied to them (and in the case of __package__, has actually been made officially redundant by the import system since Python 3.6). That means setting them is unnecessary and any time someone wants to read or potentially manipulate them they have to choose between those attributes or the spec (or update both). Either way it can lead to bugs (I know I have nearly forgotten to set both the spec and the attribute before).

I don't know if we can easily deprecate these attributes using __getattr__ on modules as added in Python 3.7, or if this is more of a documentation thing and need a long period of clearly messaging that these redundant attributes will no longer be set at some point.
History
Date User Action Args
2018-04-13 21:48:22brett.cannonsetrecipients: + brett.cannon, eric.snow
2018-04-13 21:48:22brett.cannonsetmessageid: <1523656102.14.0.682650639539.issue33277@psf.upfronthosting.co.za>
2018-04-13 21:48:22brett.cannonlinkissue33277 messages
2018-04-13 21:48:21brett.cannoncreate