Well, you know about all that. Anyway, it seems to me that our tree nodes in python should implement the relevant "magic methods", for example, that getitem should be defined to return the same thing as get_child(n), so anybody working with these nodes in Python, should actually be able to write myNode[n] to get the nth child node and so on. Well, we should have setitem hooked into set_child(index, node) and so on...
For some reason, I was trying to enhance (or refresh) my very minimal Python knowledge and I was interested in how operator overloading worked, and I came across: https://satish-p.medium.com/the-magic-of-python-a-comprehensive-guide-to-magic-methods-743bdeb4651f
Well, you know about all that. Anyway, it seems to me that our tree nodes in python should implement the relevant "magic methods", for example, that getitem should be defined to return the same thing as get_child(n), so anybody working with these nodes in Python, should actually be able to write
myNode[n]
to get the nth child node and so on. Well, we should have setitem hooked intoset_child(index, node)
and so on...Is that not a good idea?