Skip to content

Commit 4db6396

Browse files
committed
Add != (not equal) support to python NULL value
1 parent 1433f3c commit 4db6396

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ def __repr__(self):
4949
def __eq__(self, other):
5050
return isinstance(other, QPyNullVariant) or other is None
5151

52+
def __ne__(self, other):
53+
return not isinstance(other, QPyNullVariant) and other is not None
54+
5255
QPyNullVariant.__nonzero__ = MethodType(__nonzero__, None, QPyNullVariant)
5356
QPyNullVariant.__repr__ = MethodType(__repr__, None, QPyNullVariant)
5457
QPyNullVariant.__eq__= MethodType(__eq__, None, QPyNullVariant)
58+
QPyNullVariant.__ne__= MethodType(__ne__, None, QPyNullVariant)
5559

5660
# define a dummy QPyNullVariant instance NULL in qgis.core
5761
# this is mainly used to compare against

0 commit comments

Comments
 (0)