1
class Node:
    def __init__(self,c):
        self.c = c
    c = ""
    times = 0
    next = [None]*26
    
root = Node('x')
root.next[0] = Node('x')
print(root.next[1])
root.next[0].next[1] = Node('x')
print(root.next[1])

The answer:

None

<__main__.Node object at 0x0000018F31644670>

When python excute root.next[0].next[1] = Node('x') ,Node('x') also is written into root.next[1] . It is weird, why it happens?

lsxkugou
  • 11
  • 2

0 Answers0