Eric V. Smith <e...@trueblade.com> added the comment: That's a tough one. Because C.d is not set to a descriptor at type creation time (it's set to a Field object), the __set_name__ behavior is never invoked. It's when the @dataclass decorator is called that C.d is set to D().
https://docs.python.org/3/reference/datamodel.html#creating-the-class-object I'm not sure it's possible to work around this without duplicating some of the type creation code, and even then I'm not convinced it's doable. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33141> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com