2.1 loop with try & continue -> bug?

Gerhard =?unknown-8bit?Q?H=E4ring?= gh_pythonlist at gmx.de
Fri Nov 30 17:47:16 EST 2001


On Fri, Nov 30, 2001 at 10:33:45PM +0000, Marco Beri wrote:
> 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".

It's a known and fixed problem:

http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=462937

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))




More information about the Python-list mailing list