replace %(word) in a string

William Trenker wtrenker at shaw.ca
Wed Sep 17 18:00:30 EDT 2003


On Wed, 17 Sep 2003 21:01:57 +0200
Max M <maxm at mxm.dk> wrote regarding Re: replace %(word) in a string:

> class Wrapper:
> 
>      def __getitem__(self, key):
>           return locals().get(key, globals[key])

Shouldn't that be:
            return locals().get(key, globals()[key])
                                            ^^

Cheers,
Bill





More information about the Python-list mailing list