What's with the underscore(_) ????

Alfredo P. Ricafort alpot at mylinuxsite.com
Thu Dec 5 08:23:33 EST 2002


Hi,

Look at the following codes:

# file s1.py
import gettext
f=gettext.gettext
_=gettext.gettext


# file test.py
from s1 import *

print f('Hello')
print _('Hello')

Please explain to me why the 2nd print would fail with an error
'NameError: name '_' is not defined'.

Tks.


AL















More information about the Python-list mailing list