documentation: what is "::="?

Anita Kean akean at paradise.net.nz
Tue Oct 14 18:17:16 EDT 2008


On 2008-10-14, Peter Otten <__peter__ at web.de> wrote:
> Anita Kean wrote:
>>...
>> 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:
>>> 
>>> 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
>...
> 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.

That's correct.
I found that line in my .pystartup file yesterday and commenting it out
solved the problem.
I recall when I initially started using python, scrambling to find
some way to enable persistent history across sessions (something I
was used to in many other apis) and copying some suggested .pystartup
to enable this.
It solved the problem at the time, only to create others.

Thanks Peter.

And thanks everyone for the pointers on ::=
I'm still curious about why isn't it documented if it's used so much
in the documentation and is known by another name.
Obviously Wikipedia seems to think it's not totally obvious if they
have an entry. 
It sure would have made the python docs easier to read!

Anita





More information about the Python-list mailing list