Re: Re: pygettext dilemma

[email protected] (Barry A. Warsaw)
Newsgroups gmane.comp.python.internationalization
Message-ID <[email protected]>
>>>>> "MvL" == Martin v Loewis <[email protected]> writes:

    MvL> What's wrong with

    MvL>  _('No such list %(listname)s found on host %(hostname)s') %
    MvL> locals()

    MvL> No magic required; of course, this assumes that the variables
    MvL> are either all globals or all locals - I wish vars() would
    MvL> give me a dictionary of all variables (perhaps even including
    MvL> the builtins).

Bingo!  That's what I wish vars() would do to, and I want those
semantics, so I went with the _getframe() hack.

Plus, I got tired of writing trailing "% locals()" all over the place,
especially when they cluttered the code even more with long lines,
requiring continuation via extraneous paren grouping or backslashing.
Blah.

-Barry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.