This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author SebastianSpeitel
Recipients SebastianSpeitel, eric.smith
Date 2021-04-28.09:56:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619603774.32.0.102140847794.issue43965@roundup.psfhosted.org>
In-reply-to
Content
One solution I thought of was to return not an object of the same instance, but one of the same dataclass, which would allow the implementation to traverse the class hierachy of the object and create an instance of the first dataclass-class (or class with same __init__ signature) it finds with the changes applied.

This would at least allow using replace instead of it just failing in more cases.

But according to the PEP
> Creates a new object of the same type of [the] instance
the returned object has to have the same type.
History
Date User Action Args
2021-04-28 09:56:14SebastianSpeitelsetrecipients: + SebastianSpeitel, eric.smith
2021-04-28 09:56:14SebastianSpeitelsetmessageid: <1619603774.32.0.102140847794.issue43965@roundup.psfhosted.org>
2021-04-28 09:56:14SebastianSpeitellinkissue43965 messages
2021-04-28 09:56:14SebastianSpeitelcreate