Closed ericvsmith closed 6 years ago
I'm not keen on perpetuation confusion between classes and instances -- it makes code harder to read. E.g. when I see
def foo(a):
assert isdataclass(a)
I can't tell whether a is supposed to be a class or an instance.
Also note that if we are going to change this, then asdict
and astuple
should be updated, since they use isdataclass
to work only on instances.
I've already verified that there's an existing test that fails if isdataclass
is changed.
I think I'm just going to delete isdataclass
, since I can't come up with a good use case for it. It's easy enough to add later.
I've added on how to implement isdataclass() to the PEP.
Raised by Carl Meyer in https://mail.python.org/pipermail/python-dev/2017-November/150850.html.
I think he's probably correct. The current behavior, where it only works on instances, is surprising. The equivalent
attrs
API,attr.has()
, returnsTrue
for both classes and instances.