[Python-ideas] P3k __builtins__ identifiers -> warning

Scott Dial scott+python-ideas at scottdial.com
Wed Nov 28 07:11:24 CET 2007

Mark Summerfield wrote:
> My python-idea is that if python is run with -W all then it should
> report uses of __builtins__ as identifiers.

This could never work as the stdlib violates this rule and would invoke 
a large number of these warnings. And given the controversy about it, I 
doubt anyone is that interested in patching the stdlib to avoid these names.

As far as I am concerned, I don't really see the point in avoiding these 
names. As you say, several of them are very attractive and just because 
there is a built-in with that name doesn't always deter me from using 
it. The scoping rules of python are fairly simple, so it is not 
difficult to keep track of the shadowing. And it's pretty easy to 
recover a built-in by retrieving the object from the __builtins__ 
module, though not very obvious to newcomers.


Scott Dial
scott at scottdial.com
scodial at cs.indiana.edu

More information about the Python-ideas mailing list