Message61629
| Author | mark |
|---|---|
| Recipients | mark |
| Date | 2008-01-24.13:22:46 |
| SpamBayes Score | 0.26381108 |
| Marked as misclassified | No |
| Message-id | <1201180969.36.0.961933968615.issue1920@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-01-24 13:22:49 | mark | set | spambayes_score: 0.263811 -> 0.26381108 recipients: + mark |
| 2008-01-24 13:22:49 | mark | set | spambayes_score: 0.263811 -> 0.263811 messageid: <1201180969.36.0.961933968615.issue1920@psf.upfronthosting.co.za> |
| 2008-01-24 13:22:47 | mark | link | issue1920 messages |
| 2008-01-24 13:22:46 | mark | create | |