Closed ctoth closed 9 years ago
I’m not exactly sure, what you mean by not working, but would you mind looking at my fork attrs whether it does what you need (see the example in http://attrs.readthedocs.org/en/latest/examples.html#basics) ? I just worked on inheritance there (I personally consider subclassing a mistake, so it’s mostly working by guessing).
I totally agree with you -- it's a code smell. Sadly, I'm in the middle of porting a large old C++ codebase to Python. Characteristic would make my life a heck of a lot easier, and debugging a lot more pleasant, but the code in question makes use of inheritance.
On the new-style branch, I tried:
from characteristic import attributes, Attribute
@attributes
class SpaceObject(object):
name = Attribute()
@attributes
class Ship(SpaceObject):
hull_points = Attribute()
ship = Ship(name="Heart of Gold", hull_points=42)
To which I got ValueError: Missing keyword value for 'name'.
This makes me sad. Any possibility of supporting this use case?
Please really have a look at http://attrs.readthedocs.org/en/latest/examples.html#basics a first alpha is out and you have the chance to affect it before I freeze the behavior. :)
Pardon my dumb. Attrs does indeed handle this use case properly. Thank you very much, and I apologize for taking up your time.
On 3/10/2015 3:33 AM, Hynek Schlawack wrote:
Please really have a look at http://attrs.readthedocs.org/en/latest/examples.html#basics a first alpha is out and you have the chance to affect it before I freeze the behavior. :)
— Reply to this email directly or view it on GitHub https://github.com/hynek/characteristic/issues/32#issuecomment-78020797.
-Q
Accessible Software for the Blind
I'm willing to hack on this if you have a roadmap for it, or maybe I'm just doing something wrong!