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

Guido van Rossum gvanrossum at gmail.com
Sat Aug 20 18:02:25 CEST 2005


On 8/20/05, Anthony Baxter <anthony at interlink.com.au> wrote:
> On Friday 19 August 2005 02:22, Guido van Rossum 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.
> 
> I'm not sure what you're disagreeing with. Are you saying you _can't_ call
> a variable 'id', or that it's OK to do this?

That it's OK.

> > > You also can't/shouldn't call a variable 'class', 'def', or 'len' -- but
> > > I don't see any movement to allow these...
> >
> > Please don't propagate the confusion between reserved keywords and
> > built-in names!
> 
> It's not a matter of 'confusion', more that there are some names you can't
> or shouldn't use in Python. When coding twisted, often the most obvious
> 'short' name for a Deferred is 'def', but of course that doesn't work.

My point is that there are two reasons for not using such a name. With
'def', you *can't*. With 'len', you *could* (but it would be unwise).
With 'id', IMO it's okay.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list