I don't get why sys.exit(1) doesn't exit the while loop in the follow case
Ben Finney
ben+python at benfinney.id.au
Tue Oct 5 00:59:24 EDT 2010
Steven D'Aprano <steve-REMOVE-THIS at cybersource.com.au> writes:
> Why is it misleading? Is there some circumstance in Python where the
> literal 1 could have a false value?
It's misleading as to the intent.
> "while 1" was the accepted idiom for infinite loops in Python for many
> years, before the introduction of bools in (I think) Python 2.2.
[…]
Right. Now that we have boolean literals, they're semantically clearer
when the semantic value one is testing is boolean, not integer.
--
\ “Nothing is more sacred than the facts.” —Sam Harris, _The End |
`\ of Faith_, 2004 |
_o__) |
Ben Finney
More information about the Python-list
mailing list