On 9/30/2010 3:21 AM Sion Arrowsmith said...
Andreas Waldenburger<use...@geekmail.invalid>  wrote:
<http://docs.python.org/release/3.1/reference/datamodel.html#the-standard-type-hierarchy>
    [ ... ]
    Boolean values behave like the values 0 and 1, respectively, in
    almost all contexts, the exception being that when converted to a
    string, the strings "False" or "True" are returned, respectively.

Hmm. So the original problem of:

button = gtk.Button(("False,", "True,")[fill==True])

could also rewritten as:

button = gtk.Button(str(bool(fill))+",")


I think I'd prefer

button = gtk.Button("%s," % bool(fill))

Emile




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to