-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
In some of my code, I've been subclassing the following rather than PythonicPytree:
from dataclasses import replace
class UpdatablePytree(PythonicPytree):
"""A Pytree supporting self.replace(...) to functionally update fields."""
def replace(self, **kwargs):
return replace(self, **kwargs)Any myobj: MyClass where MyClass is a sub-type of UpdateablePytree supports syntax like
mynewobj = myobj.replace(x=new_x_value, y=new_y_value)to functionally update the values on the x and y field in myobj.
This issue proposes to add this implementation of .replace to PythonicPytree directly.
Metadata
Metadata
Assignees
Labels
No labels