Message341166
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. |
|
Date |
User |
Action |
Args |
2019-04-30 22:31:42 | rhettinger | set | recipients:
+ rhettinger |
2019-04-30 22:31:42 | rhettinger | set | messageid: <1556663502.82.0.194449689186.issue36762@roundup.psfhosted.org> |
2019-04-30 22:31:42 | rhettinger | link | issue36762 messages |
2019-04-30 22:31:42 | rhettinger | create | |
|