[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QPointF comparison is kinda wrong
From: Florian Bruhin <me () the-compiler ! org>
Date: 2015-06-30 11:26:28
Message-ID: 20150630112627.GQ22364 () tonks
[Download RAW message or body]
This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.
[Attachment #2 (multipart/signed)]
This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.
* Arseniy Terekhin <senyai@gmail.com> [2015-06-30 13:38:38 +0300]:
> Windows 7, python 2.7.10, PYQT_VERSION_STR = '4.11.4'
>
> >>> from PyQt4.QtCore import QPointF as p
> >>> p() < p()
> True
> >>> p() < p()
> False
> [...]
That's not anything specific to PyQt - it's just how Python 2
(unfortunately) implements comparing of incomparable types - it uses
their identity (id()) if they are of the same type:
>>> class Foo(object): pass
...
>>> Foo() < Foo()
True
>>> Foo() < Foo()
True
>>> Foo() < Foo()
False
>>> Foo() < Foo()
True
>>> Foo() < Foo()
False
On Python 3, you get a much more sensible result:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: QPointF() < QPointF()
Needless to say, I recommend switching to Python 3 ;)
Florian
--
http://www.the-compiler.org | me@the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
I love long mails! | http://email.is-not-s.ms/
[Attachment #5 (application/pgp-signature)]
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic