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 theophile
Recipients theophile
Date 2019-01-17.14:23:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547734989.68.0.404239918534.issue35761@roundup.psfhosted.org>
In-reply-to
Content
Calling dataclasses.replace(instance, **changes) returns a new object of the same type.

From my understanding there is, however, no method to update in place fields of a dataclass from another one.

I propose to add dataclasses.update(instance_to_update, other_instance, **changes).

This would for instance allow one to change all fields of current object in a sturdy way.
In my case, I currently call obj.__dict__.update(other_obj.__dict__) to perform the operation, but I know it has always to be done pretty carefully.

If this is accepted, I'm willing to post the change.
History
Date User Action Args
2019-01-17 14:23:12theophilesetrecipients: + theophile
2019-01-17 14:23:09theophilesetmessageid: <1547734989.68.0.404239918534.issue35761@roundup.psfhosted.org>
2019-01-17 14:23:09theophilelinkissue35761 messages
2019-01-17 14:23:09theophilecreate