detect_changed_props
functionsignature
detect_changed_props(old, new, path?, ancestors?): str[]Return the dotted leaf paths that changed between `old` and `new`.
Parameters
| Name | Type | Description |
|---|---|---|
old | any | Previous value. |
| Name | Type | Description |
|---|---|---|
new | any | Next value. |
| Name | Type | Description |
|---|---|---|
path? | str | Current dotted path; callers pass `""` for the root and recursion appends segments. |
| Name | Type | Description |
|---|---|---|
ancestors? | dict<int, set<int>> | None | Cycle-detection state (`id(old) -> {id(new), ...}` pairs on the current recursion path). Callers never pass this. |
Returns
str[] — A list of dotted leaf paths that changed (`"."`-separated, integer
segments for sequences, e.g. `"todos.0.title"`). `[]` if nothing
changed. Paths form a set for the caller's purposes; order is not
significant.
Example
example
>>> detect_changed_props(
... {"user": {"name": "Ada", "age": 37}},
... {"user": {"name": "Grace", "age": 37}},
... )
['user.name']
>>> detect_changed_props({"nums": [1, 2]}, {"nums": [1, 2, 3]})
['nums']