Question on statically nested scopes

Manus Hand manus at bullfrog-tech.com
Thu Aug 29 14:45:47 EDT 2002


In my code, I use a very handy trick:

class Whatever:
    def someFunction(self, **params):
        vars().update(locals())

This means that whatever named variables I pass into "someFunction"
become attributes of the object (accessible with self.varName, etc.).

Can someone PLEASE assure me that this still works in 2.2, given PEP
227, which seems to state that the vars() and locals() dictionaries are
going to henceforth be made read-only (which, if you'll pardon my
French, would really really suck, so I hope I'm misreading it)?

Thanks,
Manus Hand




More information about the Python-list mailing list