I was quite excited to see characteristic improved to use descriptors, but I was surprised by following behaviour:
from attr import attributes, attr
@attributes
class A(object):
a = attr()
@attributes
class B(A):
b = attr()
@attributes
class C(B):
c = attr()
raises a syntax error:
Traceback (most recent call last):
File "yo.py", line 15, in <module>
class C(B):
File "/home/davidc/.envs/jaguar-dev/local/lib/python2.7/site-packages/attr/_make.py", line 194, in attributes
return wrap(maybe_cl)
File "/home/davidc/.envs/jaguar-dev/local/lib/python2.7/site-packages/attr/_make.py", line 186, in wrap
cl = _add_init(cl)
File "/home/davidc/.envs/jaguar-dev/local/lib/python2.7/site-packages/attr/_make.py", line 340, in _add_init
bytecode = compile(script, unique_filename, "exec")
File "<attrs generated init 24e3b3b777d1b457ffb869223ee4a4b7665529ed>", line 1
SyntaxError: duplicate argument 'a' in function definition
So it looks like one level of inheritance works (B works as expected), but not multiple.
I was quite excited to see characteristic improved to use descriptors, but I was surprised by following behaviour:
raises a syntax error:
So it looks like one level of inheritance works (
Bworks as expected), but not multiple.