List of lists surprising behaviour

Lie Ryan lie.1296 at gmail.com
Fri Jun 18 06:46:07 EDT 2010


On 06/18/10 20:00, bart.c wrote:
> (I
> don't know if Python allows circular references, but that would give
> problems anyway: how would you even print out such a list?)


Python uses ellipsis to indicate recursive list:

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



More information about the Python-list mailing list