带有python列表的循环引用 [英] Circular Reference with python lists
本文介绍了带有python列表的循环引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以解释吗?
>>> x=x[0]=[0]
>>> x
[[...]]
>>> x is x[0]
True
>>> x[0][0][0][0][0][0][0]
[[...]]
>>> x in x
True
什么是[...]?
推荐答案
那只是Python告诉您,您有一个循环引用;它足够聪明,不会进入尝试打印出来的无限循环.
That's just Python telling you that you have a circular reference; it's smart enough not to enter an infinite loop trying to print it out.
这篇关于带有python列表的循环引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文