Recursively yield all descendant nodes in the tree starting at *node* (including *node* itself), in no specified order. This is useful if you only want to modify nodes in place and don't care about the context.
(node)
| 384 | |
| 385 | |
| 386 | def walk(node): |
| 387 | """ |
| 388 | Recursively yield all descendant nodes in the tree starting at *node* |
| 389 | (including *node* itself), in no specified order. This is useful if you |
| 390 | only want to modify nodes in place and don't care about the context. |
| 391 | """ |
| 392 | from collections import deque |
| 393 | todo = deque([node]) |
| 394 | while todo: |
| 395 | node = todo.popleft() |
| 396 | todo.extend(iter_child_nodes(node)) |
| 397 | yield node |
| 398 | |
| 399 | |
| 400 | def compare( |
no test coverage detected