attrs removes object boilerplate:
>>> import attr
>>> @attr.s
... class C(object):
... x = attr.ib(default=42)
This has many advantages, like eq/hash behavior working, reprs working, easy to add runtime validators, &c. However, it's not obvious to me how I can typecheck creating instances of this, because there's no __init__. (I'm using Python 2.7, so comment syntax, if it matters :))
attrs removes object boilerplate:
This has many advantages, like eq/hash behavior working, reprs working, easy to add runtime validators, &c. However, it's not obvious to me how I can typecheck creating instances of this, because there's no
__init__. (I'm using Python 2.7, so comment syntax, if it matters :))