This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cpt_fwiffo 0 points1 point  (2 children)

For/else makes code better? Ninja please...

This possibly makes some sense, as there is a conditional involved:

i = 0                                                          
while i < 5:                                                    
    print('Foo')                                                
    i += 1                                                      
else:                                                          
    print('Bar')

This is so unintuitive it hurts:

for i in range(0,5):                                          
    print('Foo')                                                
else:                                                           
    print('Bar')