[yocto] [RFC] Blubber, a tool to set up yocto/poky projects easily

Chris Larson clarson at kergoth.com
Mon Mar 10 07:40:34 PDT 2014


On Mon, Mar 10, 2014 at 5:02 AM, Josef Holzmayr <
jholzmayr at the-exact-steps.net> wrote:

> Hello Alex,
>
> > Alex J Lennon <ajlennon at dynamicdevices.co.uk> hat am 10. März 2014 um
> 12:43
> > geschrieben:
>
> > fwiw I'd have thought myself that string comparison should be string
> > comparison (==) as if you use an object identity comparison as a string
> > comparison (is), you potentially introduce opaque problems when the
> > strings are the same - i.e. same bytes of data - but the objects are not
> > the same for whatever reason.
>
> I've interpreted it roughly the same so far, but they ValueError point
> seems to
> valid to me too (gah, I really know why I usually avoid dynamically typed
> languages!). But the solution for me in this context seems to be then to
> use
> something like:
>
> DUMMYSTRING = "foobar"
> def safestringcompare(stra, strb):
>   return type(DUMMYSTRING) == type(stra) and type(stra) == type(strb) and
> stra
> == strb
>

Strings should be compared with ==, not is. And there's nothing that will
explode if you compare against None with ==. Try it yourself.

>>> "foo" == None
False
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20140310/f20def56/attachment.html>


More information about the yocto mailing list