On 27/07/13 20:17, Jim Mooney wrote:
Since I admitted to still being a bit confused, I though it out, and:
[[[[[L]]]]] == L
True
False propagates outward, since each containing bracket also contains
an empty object.
Its not that false propagates out, it's how Python does a comparison of
lists. The rules for equality are what matter here not the rules of
boolean conversion.
comparison operations return -1, 0 or 1.
The boolean conversion of that result is effectively the inverse of the
return value - ie 0 implies equality is true, -1 or 1 implies False.
Try:
>>> cmp([L],L)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor