Dr. Dobb's Python-URL! - weekly Python news and links (Jul 12)

Peter Otten __peter__ at web.de
Thu Jul 15 13:51:59 CEST 2004

Jacek Generowicz wrote:

> "Peter Otten" <python-url at phaseit.net> writes:
>>     Guido van Rossum is less concerned about variable names shading
>>     builtins than many posters on c.l.py.
>>         http://mail.python.org/pipermail/python-dev/2004-July/045948.html
> This gives a message about python.org's mail system moving (and that
> it is expected to finish 10 days ago).
> Anybody know a convenient alternative way of seeing this message ?

I checked it just now, maybe you need to clear some cache? 

For now (GvR answering Skip Montanaro):

> That was probably a checkin I made.  I would have left it alone except the
> code was
>     file = open(...)
> As long as I was changing the variable name to not mask the builtin I
> changed the call as well.  Had it been
>     f = open(...)
> I probably would have kept my hands off.

Hm...  I'm not particularly concerned over fixing all code that uses
file as a local variable name, unless it actually is likely to need to
reference the file class by name; builtins are in the last scope
searched for the very reason that no programmer is expected to keep up
with all additions to the built-in library, so locals hiding built-ins
is okay.  (Not that it isn't a good idea to avoid obvious clashes --
'str' for string variables and 'type' for type variables being the
most obvious stumbling blocks.)

> In any case, I was under the impression that file() was the wave of the
> future and open() a nod to the past.

Now you know better...

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


More information about the Python-list mailing list