[Python-Dev] getting at the current frame

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat, 28 Oct 2000 12:14:00 +0200


> which actually will look something like this in real code:
>
>    def trade(yours, mine):
>        print _('if you give me %(yours)s, i will give you %(mine)s') % {
>            'yours': yours,
>            'mine' : mine,
>            }
>
> The string wrapped in _() is what gets translated here.
>
> Okay, we all know that's a pain, right?

What's wrong with

    def trade(yours, mine):
        print _('if you give me %(yours)s, i will give you %(mine)s') % vars()

Look Ma, no magic!

Regards,
Martin