Python: What does _("str") do?
Posted
by
Rosarch
on Stack Overflow
See other posts from Stack Overflow
or by Rosarch
Published on 2011-01-16T22:43:22Z
Indexed on
2011/01/16
22:53 UTC
Read the original article
Hit count: 138
I see this in the Django source code:
description = _("Comma-separated integers")
description = _("Date (without time)")
What does it do? I try it in Python 3.1.3 and it fails:
>>> foo = _("bar")
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
foo = _("bar")
NameError: name '_' is not defined
No luck in 2.4.4 either:
>>> foo = _("bar")
Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
foo = _("bar")
NameError: name '_' is not defined
What's going on here?
© Stack Overflow or respective owner