[Tutor] Re: for/else question
Lee Harr
missive at hotmail.com
Fri Sep 12 17:46:16 EDT 2003
for pattern in patternl:
if elem.find(pattern) >-1:
break
else:
backl.append(elem)
To me, this says exactly the opposite of what it does... I read it as:
"do something for every element in the list,
otherwise, if I can't go through the entire list,
do that."
I suppose there may be times when this is the most concise
way to write it, but I would never write it like this.
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
More information about the Tutor
mailing list