What is a reference cycle in python?

后端 未结 4 972
灰色年华
灰色年华 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:38

    This is a reference cycle:

    l = []
    l.append(l)
    

    The first element of l, i.e. l[0], is now a cyclic reference to l itself.

提交回复
热议问题