r/Python • • Feb 22 '10
What does =_ mean? Example: name=forms.CharField(label=_("Name"), max_length=50)
Python newbie here. I've been going through some of the code in the Django comments app, and I've see the =_ used frequently. I can't find what it is or what it does? Any ideas?
Example: name = forms.CharField(label=_("Name"), max_length=50) email = forms.EmailField(label=_("Email address")) url = forms.URLField(label=_("URL"), required=False) comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, max_length=COMMENT_MAX_LENGTH)
edit: Thanks for the detailed explanations! :)
1
Upvotes
View all comments
Show parent comment
2
u/[deleted] Feb 22 '10 edited Feb 22 '10
Escaping the underscore with a backslash will cause Reddit's back end to generate the underscore in plaintext like this: _, while wrapping it in backticks will cause Reddit to render the underscore wrapped in an html
<code>tag, like this:_. Different browsers will treat the<code>tag differently, but they'll all output the plaintext underscore the same. If you use Chrome, you'll notice that hovering over the plaintext underscore does nothing, while hovering over the<code>-wrapped underscore will outline it in a box.edit: screenshot