Mailing List Archive

Re: Recursion on list
ast <ast@invalid> writes:

>> li = []
>> li.append(li)
>> li
> [[...]]
>
>>li[0][0][0][0]
> [[...]]
>
> That's funny
>

You made a list whose only element is itself.

In [1]: li = []

In [3]: li.append(li)

In [4]: li[0] is li
Out[4]: True

--
Pieter van Oostrum <pieter@vanoostrum.org>
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list