Loop until condition is true

Remi Villatel maxilys at SPAMCOP_tele2.fr
Tue Jun 21 20:01:14 EDT 2005


Fredrik Lundh wrote:

>>while True:
>>	some(code)
>>	if final_condition is True:
>>		break
>>	#
>>#

> checking if a logical expression is true by comparing it to True is bad
> style, and comparing values using "is" is also bad style.

Erm... You totally missed the point. I wrote it this way because, first, 
it's perfectly valid Python code and, second and most important, it's also a 
valid english sentence.

[CENSORED] I keep for myself how stupid I found your post.

> the correct way to write that if-statement is:

Don't try to teach your grandfather how to suck eggs. There is no "correct 
way" to code and "superfluous" isn't a synonym of "incorrect".

> and yes, the "infinite" while loop is a standard Python pattern.  get
> used to it.

Grandfathers and eggs. Now, excuse me but I have a group of savage AI 
written in bad style Python to tame.

-- 
==================
Remi Villatel
maxilys_ at _tele2.fr
==================



More information about the Python-list mailing list