Recursive lists

Stargaming stargaming at gmail.com
Tue Jul 24 16:15:08 CEST 2007


On Tue, 24 Jul 2007 02:14:38 -0700, mizrandir wrote:

> Can someone tell me why python doesn't crash when I do the following:
> 
>>>> a=[]
>>>> a.append(a)
>>>> print a
> [[...]]
>>>> print a[0][0][0][0][0][0][0]
> [[...]]
> 
> How does python handle this internally? Will it crash or use up lot's of
> memory in similar but more complicated cases?

It should be like you pointing your finger at yourself and yelling I 
guess. Just a reference, no new object.



More information about the Python-list mailing list