documentation: what is "::="?
Peter Otten
__peter__ at web.de
Tue Oct 14 03:04:38 EDT 2008
Anita Kean wrote:
> I'm guessing something like "if and only if" is implicated here?
> But for example, if I import the sys module and perform the following
> three commands,
> print sys.path
> sys.path.__str__()
> str(sys.path)
>
> the first two give me the python path, and the last reports an error:
>>
>> >>> str(sys.path)
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/usr/lib/python2.5/locale.py", line 244, in str
>> return format("%.12g", val)
>> File "/usr/lib/python2.5/locale.py", line 147, in format
>> formatted = percent % value
>> TypeError: float argument required
>>
> What is it I'm not understanding here?
Before these three commands you have probably executed
from locale import *
This has imported the locale.str() function that now shadows the builtin
str(). Had you imported locale with
import locale
(which is the recommended approach unless you're really know what you're
doing) you would have gained access to the functions in the module as, e.
g.
locale.str(...)
and still be able to access the built-ins in the usual way.
Peter
More information about the Python-list
mailing list