循环数据结构有什么好处?

2024-05-16 05:20:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚才在看"Learning Python" by Mark Lutz and came across this code sample


>>> L = ['grail']
>>> L.append(L)
>>> L
['grail', [...]]

它被认为是一种循环数据结构。

所以我在想,我的问题是:

什么是用于实际编程的“循环数据结构”?

似乎有点混乱,我认为这源于非常简短的代码示例。。。这里还有几行使用同一个对象


>>> L[0]
'grail'
>>> L[1][0]
'grail'
>>> L[1][1][0]
'grail'


Tags: andsample代码数据结构by编程codethis