I don't really get making a class and using __slots__
can someone make it clearer?
For example, I'm trying to make two classes, one is empty the other isn't. I got this so far:
class Empty:
__slots__ =()
def mkEmpty():
return Empty()
class NonEmpty():
__slots__ = ('one', 'two')
But I don't know how I would make "mkNonEmpty". I'm also unsure about my mkEmpty function.
Thanks
Edit:
This is what I ended up with:
class Empty:
__slots__ =()
def mkEmpty():
return Empty()
class NonEmpty():
__slots__ = ('one', 'two')
def mkNonEmpty(one,two):
p = NonEmpty()
p.one= one
p.two= two
return p