From 0a6373ac6bbb9e56af98e97ff93e9b609f44c0d9 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Thu, 23 Jul 2009 10:00:13 -0400 Subject: [PATCH] added note about __lt__, __eq__, and __le__ --- special-method-names.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/special-method-names.html b/special-method-names.html index b5eb365..174552f 100644 --- a/special-method-names.html +++ b/special-method-names.html @@ -670,6 +670,10 @@ class FieldStorage: x.__bool__() +
+

If you define a __lt__() method but no __gt__() method, Python will use the __lt__() method with operands swapped. However, Python will not combine methods. For example, if you define a __lt__() method and a __eq()__ method and try to test whether x <= y, Python will not call __lt__() and __eq()__ in sequence. It will only call the __le__() method. +

+

Classes That Can Be Serialized