[Python-Dev] DeprecationWarning: assignment shadows builtin

Ralf W. Grosse-Kunstleve rwgk@cci.lbl.gov
Wed, 16 Jul 2003 12:12:34 -0700 (PDT)


Starting with Python 2.3b2 I am getting DeprecationWarnings:

Python 2.3b2 (#1, Jun 30 2003, 06:35:48) 
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import std_vector
__main__:1: DeprecationWarning: assignment shadows builtin
>>> dir(std_vector)
['__doc__', '__file__', '__name__', 'array_cast', 'boost_array_sum',
'cos', 'double', 'float', 'in_place_multiply', 'int', 'long', 'size_t']

std_vector is a Boost.Python extension module
(http://www.boost.org/libs/python/doc/index.html).
It provides Python bindings for C++ std::vector<> template
instantiations, for example:

Python              C++
std_vector.int      std::vector<int>
std_vector.long     std::vector<long>
std_vector.size_t   std::vector<size_t>
std_vector.float    std::vector<float>
std_vector.double   std::vector<double>

Example usage:

a = std_vector.float((1,2,3))

Does the DeprecationWarning mean that I cannot provide this intuitive
interface anymore?

It seems to me that the names of builtin types are essentially made
equivalent to reserved keywords. I.e. from the user's perspective 2.3b2
introduces an inflation of reserved keywords. I am asking myself if the
anticipated (?) performance benefits justify this intrusive change.

Ralf