On Fri, 05 Jun 2009 17:14:52 +0700, Alexandr N Zamaraev <[email protected]>
wrote:
> Snippet:
> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit 
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> from PyQt4 import QtCore
>  >>> QtCore.QVariant(1) == QtCore.QVariant(1)
> True
>  >>> QtCore.QVariant(int) == QtCore.QVariant(int)
> False

Under the covers Python objects are wrapped in a class that manages their
reference counts so that you (and Qt internals) can safely copy QVariant
around. It's those wrappers that are being compared not the object that
they are wrapping.

It would be nice if the QVariant == operator could call the wrapper's ==
operator rather than just compare addresses.

>  >>> QtCore.QVariant([1, 2]) == QtCore.QVariant([1, 2])
> False
>  >>>
> Why?
> 
> sip-4.8-snapshot-20090603.zip
> PyQt-win-gpl-4.5-snapshot-20090601.zip

Phil
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to