Re: Recursive lists

2007-07-25 Thread mizrandir
So if I understood correctly the recursive structure isn't a problem for python because "a" contains a reference to "a", not "a" itself. On the other hand, print works ok because it has a special trap to detect recursive structures. I think I understand it now. Thnks for your replies, miz. -- ht

Re: Recursive lists

2007-07-24 Thread Stargaming
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 o

Re: Recursive lists

2007-07-24 Thread Duncan Booth
[EMAIL PROTECTED] 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 mo

Recursive lists

2007-07-24 Thread mizrandir
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? -- http://mail.pytho