idiom for constructor?

tracyshaun tracy at reinventnow.com
Mon Jun 6 14:32:31 EDT 2005


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




More information about the Python-list mailing list