What is a reference cycle in python?

后端 未结 4 971
灰色年华
灰色年华 2020-12-18 17:57

I have looked in the official documentation for python, but i cannot seem to find what a reference cycle is. Could anyone please clarify what it is for me, as i am trying to

4条回答
  •  清酒与你
    2020-12-18 18:43

    >>> x=[1,2,3]
    >>> x.append(x)
    >>> x
    [1, 2, 3, [...]]
    >>> 
    

    Now here variable x is referring to itself, this is called reference cycle.

提交回复
热议问题