On Tue, 05 Oct 2010 13:57:11 +1100, Ben Finney wrote:

> chad <cdal...@gmail.com> writes:
> 
>> while 1:
> 
> A minor point: this is more explanatory and less misleading if you write
> it as ‘while True’.

Why is it misleading? Is there some circumstance in Python where the 
literal 1 could have a false value?

"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. "while 
1" is used used as a micro-optimization in versions of Python below (I 
think) 2.7. You might prefer "while True" as nicer or even more Pythonic, 
but I disagree that "while 1" is misleading.




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to