Serhiy Storchaka <[email protected]> added the comment:
I am not sure that it is good idea to accept a type and an instance, but if it
is a goal, is_dataclass() should be defined as:
def is_dataclass(obj):
cls = obj if isinstance(obj, type) else type(obj)
return hasattr(cls, _FIELDS)
_is_dataclass_instance() should be changed too:
def _is_dataclass_instance(obj):
return hasattr(type(obj), _FIELDS)
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37868>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com