From 6c27cdd20e8a65467d8f6e05798a5a2270a9bae1 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 22 Feb 2014 21:52:44 +0000 Subject: [PATCH] Hardcode the list of attributes to be used in comparison Comparing Range subclasses may lead to surprises. --- lib/_range.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_range.py b/lib/_range.py index c4e0d4e8..47b82086 100644 --- a/lib/_range.py +++ b/lib/_range.py @@ -140,7 +140,7 @@ class Range(object): def __lt__(self, other): if not isinstance(other, Range): return NotImplemented - for attr in self.__slots__: + for attr in ('_lower', '_upper', '_bounds'): self_value = getattr(self, attr) other_value = getattr(other, attr) if self_value == other_value: