Sebastian Speitel <sebastian.spei...@outlook.de> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43965>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to