File tree Expand file tree Collapse file tree 3 files changed +12
-20
lines changed
source_py2/python_toolbox
source_py3/python_toolbox Expand file tree Collapse file tree 3 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -403,15 +403,13 @@ def are_equal(*sequences):
403403 from python_toolbox import logic_tools
404404 sequence_types = set (map (type , sequences ))
405405
406- if not sys_tools .is_pypy : # Hack around Pypy bug 1799
407- # Trying cheap comparison:
408- if len (sequence_types ) == 1 and issubclass (
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__`.)
413-
414- return logic_tools .all_equal (sequences )
406+ # Trying cheap comparison:
407+ if len (sequence_types ) == 1 and issubclass (
408+ get_single_if_any (sequence_types ), collections .Sequence ) and \
409+ not get_single_if_any (sequence_types ) == xrange :
410+ # (Excluding `xrange` from this fast check because it has no
411+ # `__eq__`.)
412+ return logic_tools .all_equal (sequences )
415413
416414 # If cheap comparison didn't work, trying item-by-item comparison:
417415 zipped = itertools .izip_longest (* sequences ,
Original file line number Diff line number Diff line change @@ -400,15 +400,11 @@ def are_equal(*sequences):
400400 from python_toolbox import logic_tools
401401 sequence_types = set (map (type , sequences ))
402402
403- if not sys_tools .is_pypy : # Hack around Pypy bug 1799
404- # Trying cheap comparison:
405- if len (sequence_types ) == 1 and issubclass (
406- get_single_if_any (sequence_types ), collections .Sequence ):
407-
408- return logic_tools .all_equal (sequences )
409- # blocktodo: test on pypy and hopefully remove these two lines if not needed
410- # if sequence_types == {CuteCount}: # Hack around Pypy bug 1799, remove
411- # return logic_tools.all_equal(sequences.start for sequence in sequences)
403+ # Trying cheap comparison:
404+ if len (sequence_types ) == 1 and issubclass (
405+ get_single_if_any (sequence_types ), collections .Sequence ):
406+
407+ return logic_tools .all_equal (sequences )
412408
413409 # If cheap comparison didn't work, trying item-by-item comparison:
414410 zipped = itertools .zip_longest (* sequences ,
Original file line number Diff line number Diff line change 99
1010
1111class _PossiblyInfiniteIntegralType (abc .ABCMeta ):
12- # blocktodo: use everywhere in python_toolbox
1312 def __instancecheck__ (self , thing ):
1413 return isinstance (thing , numbers .Integral ) or (thing in infinities )
1514class PossiblyInfiniteIntegral (numbers .Number ,
1615 metaclass = _PossiblyInfiniteIntegralType ):
1716 pass
1817
1918class _PossiblyInfiniteRealType (abc .ABCMeta ):
20- # blocktodo: use everywhere in python_toolbox
2119 def __instancecheck__ (self , thing ):
2220 return isinstance (thing , numbers .Real ) or (thing in infinities )
2321class PossiblyInfiniteReal (numbers .Number ,
You can’t perform that action at this time.
0 commit comments