On Fri, 01 Jul 2005 19:22:20 -0400, "Phillip J. Eby" <pje at 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4