[Python-Dev] new draft of PEP 227

Tim Peters tim.one@home.com
Thu, 14 Dec 2000 02:35:00 -0500

[Paul Prescod]
> ...
> Along the same lines, might a new rule make Python code more robust?
> We could say that a local can only shadow a global if the local is
> formally declared. It's pretty rare that there is a good reason to
> shadow a global and Python makes it too easy to do accidentally.

I've rarely seen problems due to shadowing a global, but have often seen
problems due to shadowing a builtin.  Alas, if this rule were extended to
builtins too-- where it would do the most good --then the names of builtins
would effectively become reserved words (any code shadowing them today would
be broken until declarations were added, and any code working today may
break tomorrow if a new builtin were introduced that happened to have the
same name as a local).