[Python-Dev] Re: A cute new way to get an infinite loop

Terry Reedy tjreedy at udel.edu
Fri Sep 24 02:31:04 CEST 2004

"Tim Peters" <tim.peters at gmail.com> wrote in message 
news:1f7befae040923012645bc07f8 at mail.gmail.com...
>>>> x = [1]
>>>> x.extend(-y for y in x)

Very similar to this old way (2.2 and I presume before):
>>> l=[1]
>>> for i in l: l.append(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
>>> len(l)

but admittedly a bit more baroque ;-)

So, are things like this a programming bug, interpreter bug, or language 
definition bug?  or just a 'gotcha'?

Terry J. Reedy

More information about the Python-Dev mailing list