I don't think this is Mac specific, but I wonder if someone could
explain why these two groups of code behave differently:
[code]
colors
= ['red', 'green', 'blue', 'orange', 'fuscia', 'black',
'white']
list_of_matches = []
for x in colors:
if x == 'red' or 'green'
or 'blue':
list_of_matches.append(x)
print
list_of_matches
list_of_matches2 = []
for x in colors:
if x == 'red':
list_of_matches2.append(x)
elif x == 'green':
list_of_matches2.append(x)
elif x == 'blue':
list_of_matches2.append(x)
else:
pass
print
list_of_matches2
[/code]
list_of_matches contains every item in colors.
list_of_matches2 only contains the matches, as I would expect.
I don't
get it......
Thanks,
Dan
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG