[EMAIL PROTECTED] wrote:
>   
>>>> Would you, say, remove "for" loops because they could be written as
>>>> "while" loops. Don't forget the word "obvious" that appears in that
>>>> catchphrase ...
>>>>
>>>>         
>>> If every "for" usage can be done with "while" and that "while" is the
>>> preferred way, why not ? As I said, the problem is that "obvious"
>>> really is subjective in many case. And if it really is obvious, it
>>> really is obvious and I doubt there would be that much disagreement.
>>>       
I think comparing "for" and "while" loops in python is problematic.  
Although yes a "for" loop could be done with a "while" in python a "for" 
loop shouldn't be used for general looping, the "obvious" case for a 
"for" loop is to iterate though a list or something similar to that.  I 
wouldn't typically use "while" loops for that, and although it could be 
done, if you were familiar with python using a "for" loop would be the 
most obvious.  I think it really is obvious in most cases with python.

Although, obvious to whom is a good question.  If you don't know the 
language very little will be obvious to you, however one who is familiar 
with python (rtfm) would know which cases should obviously use "while" 
and which cases should obviously use "for"

2cents

-- 

Carl J. Van Arsdall
[EMAIL PROTECTED]
Build and Release
MontaVista Software

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

Reply via email to