How to Suppress Interactive Assignment to "_"

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jan 4 09:51:06 CET 2010


En Fri, 01 Jan 2010 15:53:31 -0300, JKPeck <jkpeck at gmail.com> escribió:
> On Jan 1, 10:06 am, Peter Otten <__pete... at web.de> wrote:
>> JKPeck wrote:

>> > The gettext module uses the convention of defining a function named
>> > "_" that maps text into its translation.
>> > This conflicts with the automatic interactive interpreter assignment
>> > of expressions to a variable with that same name.
>>
>> $ cat displayhook.py
>> [...]
>
> Thanks.  It's just what I needed.

In case you didn't know, look at sitecustomize.py and the PYTHONSTARTUP  
[2] environment variable. They allow for the above code to be  
automatically executed.

[1] http://docs.python.org/library/site.html#index-549
[2] http://docs.python.org/using/cmdline.html#envvar-PYTHONSTARTUP

-- 
Gabriel Genellina




More information about the Python-list mailing list