[PyQt] QPyNullVariant and bool()

Deniz Turgut dturgut at gmail.com
Tue Apr 24 19:28:02 BST 2012


Would it be logical to add a __nonzero__ method to QPyNullVariant
which always returns False?

I was going through a code of mine which broke with a new version of
PyQt. I realized that it was because there is no __nonzero__ method in
QPyNullVariant so bool(QPyNullVariant) is always True.

Right now, if you use QVariant api 2, you can't check nicely (without
typechecking) whether you get a nonzero value or Null/Falsy value.

--
Deniz


More information about the PyQt mailing list