Why no warnings when re-assigning builtin names?

Gerrat Rickert grickert at coldstorage.com
Wed Aug 17 09:30:14 EDT 2011


> On 8/16/2011 7:29 PM, Terry Reedy wrote:
> 
> On 8/16/2011 1:15 PM, Gerrat Rickert wrote:
> 
> > I think that best practices would suggest that one shouldn't use
> > variable
> > names that shadow builtins (except in specific, special
> circumstances),
> > so I don't really think this would be an annoyance at all.  The
> number
> > of
> > *unwanted* warnings they'd get would be pretty close to zero.  OTOH,
> in
> > response to a question I asked on StackOverflow, someone posted a
> large
> > list of times where this isn't followed in the std lib, so there
> seems
> > to be a precedent for just using the builtin names for anything
> > one feels like at the time.
> 
> If you run across that again and email me the link, I will take a look
> and see if I think the issue should be raised on pydev. Of course, some
> modules *intentionally* define an open function, intended to be
> accessed
> as 'mod.open' and not as 'from mod import *; open'. Also,
> class/instance
> attributes can also reuse builtin names. But 'open = <True/False>'
> would
> be bad.
> 
> 
> --
> Terry Jan Reedy
> 

See the accepted answer to this question:
http://stackoverflow.com/questions/7079519/is-there-python-code-in-the-python-standard-library-that-uses-variable-names-that



More information about the Python-list mailing list