What I mean by "recursive" is something like this: [["hello", world, [1, 2, 3]], ["foo"]]
. How would I append 4 to the [1, 2, 3]
list?
I have the class:
class RabbitHole:
def __init__(self, new_name, new_holes):
self.name = new_name
self.holes = new_holes
(holes
is a list of RabbitHole
objects.)
I want to append to the hole hat
that has the "path" (names of parent holes) clothes/head/hat
. How would I change/append something to the hat hole while preserving the whole "directory tree" (I've done something like this in go but I can't figure out how to do it in python.)