attrs 17.1.0 changed the default for hash to None, which makes objects unhashable.
In #10, we set hash=False so that we can continue to use objects as keys in dictionaries, but without attempting to hash by value. This matches SQLAlchemy's default behavior.
Having __hash__ not match __cmp__ is weird, which raises the question: should we set cmp=False too? I kind of think we should, but that means attrs_sqlalchemy becomes attr.s(repr=True, hash=False, init=False, cmp=False), so all we're using attrs for is the repr.
I think we'll go ahead with #10, add a deprecation warning to attrs_sqlalchemy.attrs_sqlalchemy, and add a new decorator attrs_sqlalchemy.attrs_sqlalchemy_repr that provides only the repr.
attrs 17.1.0 changed the default for
hash
toNone
, which makes objects unhashable.In #10, we set
hash=False
so that we can continue to use objects as keys in dictionaries, but without attempting to hash by value. This matches SQLAlchemy's default behavior.Having
__hash__
not match__cmp__
is weird, which raises the question: should we setcmp=False
too? I kind of think we should, but that meansattrs_sqlalchemy
becomesattr.s(repr=True, hash=False, init=False, cmp=False)
, so all we're using attrs for is the repr.I think we'll go ahead with #10, add a deprecation warning to
attrs_sqlalchemy.attrs_sqlalchemy
, and add a new decoratorattrs_sqlalchemy.attrs_sqlalchemy_repr
that provides only the repr.Thoughts?
hash=False
(#10)attrs_sqlalchemy.attrs_sqlalchemy
attrs_sqlalchemy.attrs_sqlalchemy_repr