John Salerno wrote:
> I'm having some slight trouble understanding exactly why this creates an 
> infinite loop:
>
> L = [1, 2]
> L.append(L)

I tried this with Python 2.3.5 and it handles this tailbiter in a
very pleasantly surprising way:

>>> l = [ 0, 1 ]
>>> l.append( l )
>>> l
[0, 1, [...]]
>>> l[2]
[0, 1, [...]]
>>> l[2][2][2][2][2][2][2][0]
1

The [...] I have never seen before anywhere, is it documented?

--
  --  Ewald

 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to