Circular Reference with python lists

后端 未结 3 769
旧时难觅i
旧时难觅i 2020-12-07 03:29

Can someone explain this?

>>> x=x[0]=[0]
>>> x
[[...]]
>>> x is x[0]
True
>>> x[0][0][0][0][0][0][0]
[[...]]
>>>         


        
3条回答
  •  被撕碎了的回忆
    2020-12-07 03:46

    iPython will do this:

    []

    It's the same thing; the interpreter telling you that you have a recursive data structure.

提交回复
热议问题