quatrope/uttrs

make uttrs superset of attrs?

Closed this issue · 2 comments

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?

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:

  1. To add more automatic behavior to classes (as proposed in # 4) we should redefine @ attr.s to something like @ uttr.s.
  2. another alternative (maybe easier), would be to add code that makes an attribute with unit = None is equivalent to using attr.ib

Example

All the attributes are equivalent

@attr.s()
class Foo:
    a = attr.ib()
    b = uttr.ib(unit=None)
    c = uttr.ib()

I like all options
b) and c) could be done with a default keyword.