On Wed, Sep 29, 2010 at 05:58:16AM -0700, bruno.desthuilli...@gmail.com wrote:
> 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)])

That is assuming the original coder would want the argument "True,"
in such cases. You don't know that.

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

Reply via email to