2.1 loop with try & continue -> bug?

Marco Beri mberiatlinkgroupdotit at takebeforeatandtranslate.it
Fri Nov 30 17:33:45 EST 2001


Hi,
look at this simple program:

	print "Running..."
	cont=0
	while -1 :
		print cont
		cont = cont + 1
		try:
			if cont == 2:
				continue
			if cont == 3:
				break
		except:
			pass

If I run it with python 2.1, this is the output:
	Running...
	0
	1
	2
	Running...
	0
	1
	2
	.
	.
	.

And so on, so it's clear that the "break" statement is never reached.
It seems that the "continue" included into the "try" statemente break
to an understood "while".
Why?
Thanks for your time.
Ciao.
Marco.
P.S. If I run it with python 1.5.2 at least I got an error.



More information about the Python-list mailing list