(tree, value)
| 258 | |
| 259 | print("Example 18") |
| 260 | def contains_match_class(tree, value): |
| 261 | match tree: |
| 262 | case Node(value=pivot, left=left) if value < pivot: |
| 263 | return contains_match_class(left, value) |
| 264 | case Node(value=pivot, right=right) if value > pivot: |
| 265 | return contains_match_class(right, value) |
| 266 | case Node(value=pivot) | pivot: |
| 267 | return pivot == value |
| 268 | |
| 269 | |
| 270 | assert contains_match_class(obj_tree, 9) |