Théophile Chevalier <[email protected]> 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
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.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35761>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com