[Python-Dev] Deprecating builtin id (and moving it to sys())

Jeremy Hylton jeremy at alum.mit.edu
Fri Aug 19 23:15:15 CEST 2005


On 8/18/05, Guido van Rossum <gvanrossum at gmail.com> wrote:
> On 8/17/05, Anthony Baxter <anthony at interlink.com.au> wrote:
> > If you _really_ want to call a local variable 'id' you can (but shouldn't).
> 
> Disagreed. The built-in namespace is searched last for a reason -- the
> design is such that if you don't care for a particular built-in you
> don't need to know about it.

In practice, it causes much confusion if you ever use a local variable
that has the same name as the built-in namespace.  If you intend to
use id as a variable, it leads to confusing messages when a typo or
editing error accidentally removes the definition, because the name
will still be defined for you.  It also leads to confusion when you
later want to use the builtin in the same module or function (or in
the debugger).  If Python defines the name, I don't want to provide a
redefinition.

Jeremy


More information about the Python-Dev mailing list