Re: idiom for constructor?
How about just doing this: class Foo(object): __slots__ = ('a','b','c','d') def __init__(self, *args): for (name, arg) in zip(self.__slots__, args): setattr(self, name, arg) --T -- http://mail.python.org/mailman/listinfo/python-list
Re: idiom for constructor?
And you probably should add: ... def __init__(self, *args): assert len(args) == len(self.__slots__) ... --T -- http://mail.python.org/mailman/listinfo/python-list