Jonathan LaCour wrote: > > This is not a "symbol" (in the sense you mean, @ or $ in Perl and > > Ruby), it is a function called (or aliased) "_". > > I know its not a symbol in the language sense, but it sure looks like > one to the untrained eye (which was my point, that you apparently > missed).
No, it's a function call, with the correct Python syntax, and a shortcut used in many languages (see below). > <sarcasm> > Yes, thats exactly what I am saying. Lets go back to C. A C-based > TurboGears would be amazing. > </sarcasm> Now, there's a challenge ! > > A project like TurboGears will attract lots of newbies to Python, > potentially coming from PHP, or other such tools. I am almost > certain that the majority of these people will be confused by the > "_", what it means, and where it came from. I just was trying to > avoid this. Uh huh. I quote from the PHP manual: "This function returns a translated string if one is found in the translation table, or the submitted message if not found. You may use the underscore character '_' as an alias to this function." : http://fi2.php.net/manual/fi/function.gettext.php > Understandable, as long as things don't start down a slippery slope! > Ramming things into __builtins__ for the purposes of a shortcut just > seems like a scary precedent to set. But, its your decision to make, > and you seem to agree that magic is generally bad, so I won't > complain anymore :) I agree with you that "magic" is not Pythonic and should be largely avoided (that's actually why I prefer TG to Django or Rails). However here we are following precedent in the standard Python gettext library, replacing the install() function with one that uses our own version of gettext for handling threaded, multi-user web applications. Of course if you prefer to make your code clear on that point just have: from turbogears.i18n import gettext as _ at the start of your modules.

