Hello Chris > Chris Larson <clar...@kergoth.com> hat am 10. März 2014 um 15:40 geschrieben: > > > On Mon, Mar 10, 2014 at 5:02 AM, Josef Holzmayr < > jholzm...@the-exact-steps.net> wrote: > > > Hello Alex, > > > > > Alex J Lennon <ajlen...@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
Yes. You're right. Makes me feel even worse about my python knowledge, but at least it seems the topic is clarified now. Thanks for that! Greetz Josef/Leto -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto