make uttrs superset of attrs?
Closed this issue · 2 comments
martinberoiz commented
Can we make uttrs refer all unitless attributes to attrs? so that user doesn't need to juggle with both uttrs and attrs?
Some kind of superset of attrs?
leliel12 commented
The fundamental idea of uttrs is to be an extension of attrs, and not a replacement. Adding more things would imply making a decision about two things:
- To add more automatic behavior to classes (as proposed in # 4) we should redefine
@ attr.s
to something like@ uttr.s
. - another alternative (maybe easier), would be to add code that makes an attribute with
unit = None
is equivalent to usingattr.ib
Example
All the attributes are equivalent
@attr.s()
class Foo:
a = attr.ib()
b = uttr.ib(unit=None)
c = uttr.ib()
martinberoiz commented
I like all options
b) and c) could be done with a default keyword.