[issue36762] Teach "import *" to warn when overwriting globals or builtins

Serhiy Storchaka report at bugs.python.org
Thu May 2 00:56:17 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

This will force legal third-party code to add special code to suppress warnings. This is breaking change.

Other problem is with shadowing builtins. This increases chance of breakage when introduce new builtins. Currently adding a new builtin does not affect existing code which does not use this builting, but all will be changed if implement this feature.

Since shadowing a builtin and overwriting an existing global is not always an error, I think this warning should not be the part of the interpreter, but rather a part of third-party linters (which can be configured to ignore some warnings for particular projects).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36762>
_______________________________________


More information about the Python-bugs-list mailing list