File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
source_py2/python_toolbox
source_py3/python_toolbox/sequence_tools Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -406,7 +406,10 @@ def are_equal(*sequences):
406406 if not sys_tools .is_pypy : # Hack around Pypy bug 1799
407407 # Trying cheap comparison:
408408 if len (sequence_types ) == 1 and issubclass (
409- get_single_if_any (sequence_types ), collections .Sequence ):
409+ get_single_if_any (sequence_types ), collections .Sequence ) and \
410+ not get_single_if_any (sequence_types ) == xrange :
411+ # (Excluding `xrange` from this fast check because it has no
412+ # `__eq__`.)
410413
411414 return logic_tools .all_equal (sequences )
412415 # blocktodo: test on pypy and hopefully remove these two lines if not needed
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ def __init__(self, *args):
135135
136136 __hash__ = lambda self : hash (self ._reduced )
137137
138- __eq__ = lambda self , other : (isinstance ( other , CuteRange ) and
138+ __eq__ = lambda self , other : (type ( self ) == type ( other ) and
139139 (self ._reduced == other ._reduced ))
140140
141141 distance_to_cover = caching .CachedProperty (lambda self :
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ def __init__(self, *args):
129129
130130 __hash__ = lambda self : hash (self ._reduced )
131131
132- __eq__ = lambda self , other : (isinstance ( other , CuteRange ) and
132+ __eq__ = lambda self , other : (type ( self ) == type ( other ) and
133133 (self ._reduced == other ._reduced ))
134134
135135 distance_to_cover = caching .CachedProperty (lambda self :
You can’t perform that action at this time.
0 commit comments