[Python-Dev] DeprecationWarning: assignment shadows builtin (original) (raw)

Guido van Rossum guido@python.org
Wed, 16 Jul 2003 16:43:44 -0400


Ralf W. Grosse-Kunstleve wrote: > >>> import stdvector > main:1: DeprecationWarning: assignment shadows builtin > >>> dir(stdvector) > ['doc', 'file', 'name', 'arraycast', 'boostarraysum', > 'cos', 'double', 'float', 'inplacemultiply', 'int', 'long', 'sizet'] > > stdvector is a Boost.Python extension module

[Neil]

I suspect the warning is shown due to the way Boost builds the namespace of the extension module. Shadowing of builtin names is checked by the setattr method of the module type. Boost is probably using modulesetattr to populate the global dictionary. There's nothing wrong with doing that except that it triggers a spurious warning.

But this is yet another situation where this warning is issued but it really shouldn't be issued. I'm beginning to think that perhaps we should make it a PendingDeprecationWarning instead? That should be simple even this close to the 2.3c1 release.

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