On Sun, 01 Aug 2010 19:49:11 +0200, Linos <i...@linos.es> wrote:
> Hello,
>       i don't know if this is a bug or an intended behavior but i am using in
>       my
> machine Arch Linux pyqt 4.7.4 with sip 4.10.5 and in older versions the
> behavior 
> was:
> 
> combo = QComboBox()
> if combo:
>       print "exists"
> else:
>       print "is none"
> 
> would print "exists" and now it prints "is none", i suppose it is a bug
> because 
> the same test with QLabel still print "exists", i have not tested other
> classes 
> though.

It's a side effect of an intended change that is triggering a bug in your
code.

QComboBox() now has a __len__() method which changes the behaviour of "if
combo".

If you want to test for None then you should always do so explicitly...

if combo is None:
    print "is none"
else:
    print "exists"

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to