New submission from Mark Summerfield:

I am using:

Python 3.0a2 (r30a2:59382, Dec 17 2007, 08:47:22) 
[GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2
IDLE 3.0a1 

This seems wrong:

>>> while False:
        print("no")
else:
        print("yes")

        
>>> 

I expected it to print "yes" because the docs say that the else suite is
executed if present and if the loop terminated normally (no break), and
this is the case here.

This works though:

>>> x = False
>>> while x:
        print("no")
else:
        print("yes")

        
yes
>>> 

So it seems that "while False" and "while variable" are giving different
behaviour.

----------
components: Interpreter Core
messages: 61629
nosy: mark
severity: normal
status: open
title: while else loop seems to behave incorrectly
type: behavior
versions: Python 3.0

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1920>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to