Question on statically nested scopes
manus at bullfrog-tech.com
Thu Aug 29 15:04:02 EDT 2002
Okay, so my code snippet wasn't 100% accurate. Change "locals()" to
Manus (who copied the top line from function X -- which used a ** parameter
and the second line from function Y -- which named all the incoming
the def line -- while typing the post; sorry about that. Just goes to show
you that I
use stuff like this all the time, though, doesn't it?)
Manus Hand wrote:
> In my code, I use a very handy trick:
> class Whatever:
> def someFunction(self, **params):
> 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)?
> Manus Hand
More information about the Python-list