reflected greater than magic methods
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping
--
Chapters
00:00 Question
01:32 Accepted answer (Score 3)
01:56 Answer 2 (Score 3)
02:09 Answer 3 (Score 0)
02:25 Thank you
--
Full question
https://stackoverflow.com/questions/3017...
Accepted answer links:
[functools.total_ordering]: https://docs.python.org/3/library/functo...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #magicmethods
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping
--
Chapters
00:00 Question
01:32 Accepted answer (Score 3)
01:56 Answer 2 (Score 3)
02:09 Answer 3 (Score 0)
02:25 Thank you
--
Full question
https://stackoverflow.com/questions/3017...
Accepted answer links:
[functools.total_ordering]: https://docs.python.org/3/library/functo...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #magicmethods
#avk47
ANSWER 1
Score 4
__lt__ is __gt__'s counterpart; you'll need to implement __lt__. While you're at it, you should probably implement __le__ and __ge__.
ACCEPTED ANSWER
Score 3
You can use a functools.total_ordering decorator to create the missing comparison methods for you:
import functools
@functools.total_ordering
class Property():
...
Then you get False, False, False. Do make sure to read its documentation, though.
ANSWER 3
Score 0
Since you've declared the __float__() method, you could always write it as:
print float(y) > float(x)