A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-September/049066.html below:

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

[Python-Dev] Re: A cute new way to get an infinite loopTim Peters tim.peters at gmail.com
Fri Sep 24 06:14:56 CEST 2004
[Terry Reedy]
> Very similar to this old way (2.2 and I presume before):

Been there forever, yes.

> >>> l=[1]
> >>> for i in l: l.append(i)
> ...
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
> KeyboardInterrupt
> >>> len(l)
> 1623613
>
> but admittedly a bit more baroque ;-)
>
> So, are things like this a programming bug, interpreter bug, or language
> definition bug?  or just a 'gotcha'?

They're features, provoked into revealing their dark sides by pilot
error.  It's not an accident that I posted my note right after
checking in a new test, in test_long.py, containing:

       cases.extend([-x for x in cases])

I will not admit that it didn't always contain the square brackets. 
And if I won't admit that, I *sure* won't admit that I initially
feared hairy new code for mixed float-vs-long comparison contained an
infinite loop <wink>.

never-getting-an-infinite-loop-is-a-symptom-of-not-trying-hard-enough-ly
y'rs  - tim
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4