Message333872
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. |
|
Date |
User |
Action |
Args |
2019-01-17 14:23:12 | theophile | set | recipients:
+ theophile |
2019-01-17 14:23:09 | theophile | set | messageid: <1547734989.68.0.404239918534.issue35761@roundup.psfhosted.org> |
2019-01-17 14:23:09 | theophile | link | issue35761 messages |
2019-01-17 14:23:09 | theophile | create | |
|