Python 3 __cmp__ semantic change?

Inyeol.Lee at gmail.com Inyeol.Lee at gmail.com
Thu Nov 20 16:33:21 EST 2008


On Nov 20, 1:18 pm, Johannes Bauer <dfnsonfsdu... at gmx.de> wrote:
> Hello group,
>
> I'm porting some code of mine to Python 3. One class has the __cmp__
> operator overloaded, but comparison doesn't seem to work anymore with that:
>
> Traceback (most recent call last):
>   File "./parse", line 25, in <module>
>     print(x < y)
> TypeError: unorderable types: IP() < IP()
>
> Was there some kind of semantic change?

Overload __lt__ method.

Inyeol



More information about the Python-list mailing list