
July 1, 2005
11:28 p.m.
On Fri, 01 Jul 2005 19:22:20 -0400, "Phillip J. Eby" <pje@telecommunity.com> wrote:
At 03:59 PM 7/1/2005 -0700, Ralf W. Grosse-Kunstleve wrote: [snip]
This extends to any number of arguments:
class grouping: def __init__(self, x, y, z): self.__dict__.update(locals()) del self.self
If you use vars(self).update(locals()), it even looks halfway pleasant ;) I'm not sure what python-dev's current opinion of vars(obj) is though (I'm hoping someone'll tell me). Of course, both of these fall over for __slots__'ful classes. It'd be nice if there were a general way to deal with attributes of an instance, regardless of the implementation details of its memory layout. Jp