alekosot
alekosot

Reputation: 701

Multiple imports in python as the same keyword

I am more or less a python noob and while getting my hands dirty, in one of the modules I am using, I encountered this statement:

from django.utils.translation import ugettext, ugettext_lazy as _

The statement is django and i18n related, but the question is of a more general nature... I think. So, if I use _("some string to be translated") in my code, which one is the function called, ugettext or ugettext_lazy?

Upvotes: 0

Views: 98

Answers (1)

Peter DeGlopper
Peter DeGlopper

Reputation: 37319

The comma divides up clauses of the import statement. That code is equivalent to:

from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _

Upvotes: 3

Related Questions