On Fri, Jul 4, 2008 at 6:25 AM, Kelie <[EMAIL PROTECTED]> wrote: > Hello, > > I see a lots tr('some string') in codes, especially the ones related to > wxPython. Where is this tr function defined and what does it do? To make the > argument a raw string?
tr() is not a standard part of Python. My guess is that it is a wrapper function that helps with localization. Raw strings are a syntactic construct, i.e. they exist only in source code as an instruction to the parser. There is no such thing as a raw string at runtime, so there is no function to create one. > When I type print tr('some string') in PyShell that comes with wxPython, no > error. But if I type that line in a .py file and run it, I get an error: > NameError: name 'tr' is not defined You have to find where tr() is being imported. From PyShell type tr.__module__ that should print the name of the module containing tr(). Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor