[issue35761] Allow dataclasses to be updated in place

2019-06-02 Thread Eric V. Smith
Eric V. Smith added the comment: I'm going to reject this. There's nothing special about dataclasses that would require a feature like this. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue35761] Allow dataclasses to be updated in place

2019-01-18 Thread Théophile Chevalier
Théophile Chevalier added the comment: I cannot do self.position = obj because I have references on position elsewhere. -- ___ Python tracker ___ __

[issue35761] Allow dataclasses to be updated in place

2019-01-18 Thread Théophile Chevalier
Théophile Chevalier added the comment: I understand your points, I'll give an example with a simplified version of my problem: import dataclasses import othermodule # is an external dependency @dataclass class City: name: str position: othermodule.Point # Point is a dataclass de

[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Eric V. Smith
Eric V. Smith added the comment: I agree that I don't see the point, unless there's something I'm missing with other_instance. Or maybe the proposal is for it to also work with frozen dataclasses? I'm definitely -1 on that. So unless there's something I'm missing where normal attribute assig

[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm don't see the point of this proposal. The fields of dataclasses are already mutable, so they can be updated just like any other object (no need for a special mechanism): a = InventoryItem(name='Widget', unit_price=37.25, quantity_on_hand=10) a.quant

[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Eric V. Smith
Eric V. Smith added the comment: What would the interaction be between other_instance and changes? Why is this API different from .replace()? -- assignee: -> eric.smith nosy: +eric.smith ___ Python tracker ___

[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue35761] Allow dataclasses to be updated in place

2019-01-17 Thread Théophile Chevalier
New submission from Théophile Chevalier : 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_upd