On Fri, 01 Jul 2005 19:22:20 -0400, "Phillip J. Eby" <[EMAIL PROTECTED]> 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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to