smarie/python-autoclass

What about slots ?

smarie opened this issue · 1 comments

What about slots ?

As of today, autoclass works with slotted classes but you need to declare the slots explicitly:

@autoclass
class Foo(object):
    __slots__ = ('_foo1', '_foo2')

    def __init__(self, foo1, foo2=0):
        pass

Since @autoclass decorator is applied after the class has been created, the only way for us transform it automatically to a slot-ed class would be to generate a new type.