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 rhettinger
Recipients rhettinger
Date 2019-04-30.22:31:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556663502.82.0.194449689186.issue36762@roundup.psfhosted.org>
In-reply-to
Content
One reason we usually suggest that people don't use star imports is that it is too easy to shadow a builtin or overwrite an existing global.  Momma Gump always used to say, "import star is like a box of chocolates, you never know what you've going to get".

>>> from os import *
Warning (from warnings module):
  File "__main__", line 1
ImportWarning: The 'open' variable in the 'os' module shadows a variable in the 'builtins' module

>>> alpha = 2.0
>>> beta = 3.0
>>> gamma = 4.5
>>> delta = 5.5
>>> from math import *
>>> from os import *
Warning (from warnings module):
  File "__main__", line 8
ImportWarning: The 'gamma' variable in the 'math' overwrites an existing variable in the globals.
History
Date User Action Args
2019-04-30 22:31:42rhettingersetrecipients: + rhettinger
2019-04-30 22:31:42rhettingersetmessageid: <1556663502.82.0.194449689186.issue36762@roundup.psfhosted.org>
2019-04-30 22:31:42rhettingerlinkissue36762 messages
2019-04-30 22:31:42rhettingercreate