Skip to content

Commit afd8575

Browse files
committed
-
1 parent 6f5606b commit afd8575

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

source_py3/python_toolbox/sequence_tools/cute_range.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from python_toolbox import caching
88

9+
from .misc import CuteSequence
10+
911
infinity = float('inf')
1012
infinities = (infinity, -infinity)
1113
NoneType = type(None)
@@ -105,7 +107,7 @@ def __call__(cls, *args, _avoid_built_in_range=False):
105107
return super().__call__(*args)
106108

107109

108-
class CuteRange(collections.Sequence, metaclass=CuteRangeType):
110+
class CuteRange(CuteSequence, metaclass=CuteRangeType):
109111
'''
110112
Improved version of Python's `range` that has extra features.
111113
@@ -133,6 +135,12 @@ def __init__(self, *args):
133135

134136
@caching.CachedProperty
135137
def length(self):
138+
'''
139+
The length of the `CuteRange`.
140+
141+
We're using a property `.length` rather than the built-in `__len__`
142+
because `__len__` can't handle infinite values.
143+
'''
136144
from python_toolbox import math_tools
137145

138146
if math_tools.get_sign(self.distance_to_cover) != \

0 commit comments

Comments
 (0)