martinthenext/eth_ml — pull request #9 by go1dshtein (2014-04-18 14:25:19+00:00)
Title: __slots__ is meaningless.

It is meaningless to use ```__slots__``` in ```__init__```. Python creates ```__dict__``` and ```__weakref__``` before ```__init__``` invocation.

See:
```python
>>> class A(object):
... def __init__(self):
... self.a = 5
...
>>> a = A()
>>> dir(a)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'a']
>>> class B(object):
... def __init__(self):
... self.__slots__ = "a"
... self.a = 5
...
>>> b = B()
>>> dir(b)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '__weakref__', 'a']
>>> class C(object):
... __slots__ = "a"
... def __init__(self):
... self.a = 5
...
>>> c = C()
>>> dir(c)
['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', 'a']
>>>
```