On 29 sep, 13:38, Hrvoje Niksic <hnik...@xemacs.org> wrote: > Tracubik <affdfsdfds...@b.com> writes: > > > button = gtk.Button(("False,", "True,")[fill==True])
(snip) > BTW adding "==True" to a boolean value is redundant and can even break > for logically true values that don't compare equal to True (such as the > number 10 or the string "foo"). Note that if fill is actually an int outside the (0, 1) domain, it will break too. The correct test would be: ("False,", "True,")[bool(fill)]) >>> ['a', 'b'][bool(10)] 'b' >>> ['a', 'b'][bool('')] 'a' >>> ['a', 'b'][bool("yes")] 'b' >>> ['a', 'b'][bool([])] 'a' >>> ['a', 'b'][bool([42, 24])] 'b' >>> ['a', 'b'][bool(None)] 'a' >>> -- http://mail.python.org/mailman/listinfo/python-list