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 eric.smith, remi.lapeyre, rhettinger, theophile
Date 2019-01-18.13:55:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547819727.14.0.485882669633.issue35761@roundup.psfhosted.org>
In-reply-to
Content
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

    def update_position(self):
        obj = anymodule.get_position(name=self.name)
        
        # The classic solution would be to do
        self.position.x = obj.x
        self.position.y = obj.y

        # what if othermodule adds z (altitude) to Point?
        # we could imagine:
        dataclasses.update(self.position, obj)

        # I'm currently doing:
        self.position.__dict__.update(obj.__dict__)

Maybe I simply handle the issue the wrong way, so my dataclass proposal is out of scope.
History
Date User Action Args
2019-01-18 13:55:29theophilesetrecipients: + theophile, rhettinger, eric.smith, remi.lapeyre
2019-01-18 13:55:27theophilesetmessageid: <1547819727.14.0.485882669633.issue35761@roundup.psfhosted.org>
2019-01-18 13:55:27theophilelinkissue35761 messages
2019-01-18 13:55:26theophilecreate