So Python 3.7 is going to gain Data Classes. TLDR; it's a shorthand to write classes that are essentially groups of attributes, but:
also gain automatically useful implementations of many dunder methods (including __repr__ and __init__)
don't need to use namedtuple, which is nice, but has its own challenges, like being immutable
The attrs library provides a lot of this today, though with not quite as nice a syntax. It'd be nice to update our namedtuples to something better, and it'd be good to not use more of them.
So I guess what I'm looking for is: are there arguments against starting to use attrs before we can just rely on Python >= 3.7? (this case is probably 5 years away.) We'd have to do a minor conversion from attrs to just use Python 3.7; probably not much work, and I guess if we find we really love attrs that much, we wouldn't have to move.
So Python 3.7 is going to gain Data Classes. TLDR; it's a shorthand to write classes that are essentially groups of attributes, but:
__repr__
and__init__
)namedtuple
, which is nice, but has its own challenges, like being immutableThe attrs library provides a lot of this today, though with not quite as nice a syntax. It'd be nice to update our
namedtuple
s to something better, and it'd be good to not use more of them.So I guess what I'm looking for is: are there arguments against starting to use
attrs
before we can just rely on Python >= 3.7? (this case is probably 5 years away.) We'd have to do a minor conversion from attrs to just use Python 3.7; probably not much work, and I guess if we find we really love attrs that much, we wouldn't have to move.