Tracubik <affdfsdfds...@b.com> writes: > Hi all, > I'm studying PyGTK tutorial and i've found this strange form: > > button = gtk.Button(("False,", "True,")[fill==True]) > > the label of button is True if fill==True, is False otherwise.
The tutorial likely predates if/else expression syntax introduced in 2.5, which would be spelled as: button = gtk.Button("True" if fill else "False") 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"). -- http://mail.python.org/mailman/listinfo/python-list