[Sugar-devel] [PATCH 1/2] Fix presence detection of keyboard layouts/options
Frederick Grose
fgrose at gmail.com
Thu Oct 6 13:57:35 EDT 2011
On Thu, Oct 6, 2011 at 1:22 PM, Daniel Drake <dsd at laptop.org> wrote:
> On Thu, Oct 6, 2011 at 6:13 PM, Frederick Grose <fgrose at gmail.com> wrote:
> > But try this:
> > foo = 0
> > if foo:
> > print 'foo is not None'
>
> Yes, I'm aware that the boolean operator also has meaning for
> numerical values. But that doesn't affect my patch and the context of
> this code. Or am I missing something?
>
> Thanks,
> Daniel
>
"foo" alone as a boolean operator is an equivalent length check,
> and also serves as a "is not None" check too.
No, you are not missing something, but the casual reader may want to take
note that if foo: serves only as a "is not None or is zero" check.
So if foo is not None: is a more robust check for that singular condition.
That's all, just an aside. Thanks. --Fred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20111006/db25a061/attachment.html>
More information about the Sugar-devel
mailing list