method gets overwritten?!

Martin v. Löwis martin.vonloewis at hpi.uni-potsdam.de
Fri Mar 14 11:09:52 EST 2003


> > Uhm, why do I get this error?  Why is _ overwritten with a string?  _
got
>
> The interactive interpreter uses name _ in the __builtins__ module to
store
> the last non-None result from an expression-statement.  You can change
this
> behavior by assigning sys.displayhook to your callable that does whatever
> you prefer with all results from expression-statements typed at the
> interactive interpreter prompt, rather than displaying and binding to name
> __builtins__._ such results as the default sys.displayhook does.

OTOH, I'd advise against using .install; modifying the builtins is evil.
Instead, do

_ = t.gettext

in each module where _ is meant to do translations.

Regards,
Martin






More information about the Python-list mailing list