A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-April/110928.html below:

[Python-Dev] Why doesn't `functools.total_ordering` use the existing ordering methods?

[Python-Dev] Why doesn't `functools.total_ordering` use the existing ordering methods? [Python-Dev] Why doesn't `functools.total_ordering` use the existing ordering methods?cool-RR cool-rr at cool-rr.com
Mon Apr 25 20:43:49 CEST 2011
Hello,

Today I was trying to use `total_ordering` for the first time. I was
expecting that in order to implement e.g. `x > y` it would do `not x < y and
not x == y`, assuming that `__lt__`  and `__eq__` are defined. But I see it
just does `y < x`, which is problematic. For example if you have a class
that is decorated by `total_ordering`, and implements only `__lt__`  and
`__eq__`, then trying to do `x < y` will result in infinite recursion.

Why not have `total_ordering` work in the way I suggested?


Ram.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110425/82704617/attachment.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4