Rick Teachey <[email protected]> added the comment:
The init method that comes up for int, str, float, etc is just the object init:
assert int.__init__ is object.__init__
Probably the thing to do is grab any init methods that aren't the
object.__init__ while stripping out the dataclass-created init methods? Maybe
something like:
import warnings
if cls.__dataclass_params__.init:
for pcls in cls.mro():
if pcls.__init__ is not object.__init__:
try:
d_params = getattr(pcls, "__dataclass_params__")
except AttributeError:
warnings.warn('Found a not called init')
else:
if not d_params.init:
warnings.warn('Found a custom dataclass init')
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33452>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com