Message333962
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. |
|
Date |
User |
Action |
Args |
2019-01-18 13:55:29 | theophile | set | recipients:
+ theophile, rhettinger, eric.smith, remi.lapeyre |
2019-01-18 13:55:27 | theophile | set | messageid: <1547819727.14.0.485882669633.issue35761@roundup.psfhosted.org> |
2019-01-18 13:55:27 | theophile | link | issue35761 messages |
2019-01-18 13:55:26 | theophile | create | |
|