transform list of int in a list of string??

Peter Hansen peter at
Fri Sep 13 21:38:55 EDT 2002

Peter Hansen wrote:
> jubafre at wrote:
>> my program have other modules imported, like re and sre and i put a 
>> convertion int to str but doesn´t work
>> t=str(x[i])
>> Traceback (most recent call last):
>>   File "C:\Documents and Settings\jubafre\Desktop\montador\", 
>> line 78, in ?
>>     t=str(x[i])
>> TypeError: 'list' object is not callable
> This error is most likely because you created a list object
> bound to the name "str".  Do *not* use "str" or other such
> reserved names as variable names if you want to preserve your
> sanity. :-)

More on this: they're not really "reserved", just built-in names
that your local definitions will hide if you aren't careful.

To see the full list:

 >>> import __builtin__
 >>> dir(__builtin__)
['ArithmeticError', 'AssertionError', .......  'xrange', 'zip' ]

Also, you can safely use them if you know what you're doing and
decide you really do want a variable with that name, but obviously
you can't use the built-in function with the same name if you do so.


More information about the Python-list mailing list