11import abc
2- import builtins
32import types
43import collections
54import numbers
@@ -77,7 +76,11 @@ def _is_integral_or_none(thing):
7776
7877class CuteRangeType (abc .ABCMeta ):
7978 '''Metaclass for `CuteRange`, see its docstring for details.'''
80- def __call__ (cls , * args , _avoid_built_in_range = False ):
79+ def __call__ (cls , * args , ** kwargs ):
80+
81+ _avoid_built_in_range = kwargs .pop ('_avoid_built_in_range' , False )
82+ assert not kwargs
83+
8184 # Our job here is to decide whether to instantiate using the built-in
8285 # `range` or our kickass `Range`.
8386 from python_toolbox import math_tools
@@ -107,7 +110,7 @@ def __call__(cls, *args, _avoid_built_in_range=False):
107110 return super ().__call__ (* args )
108111
109112
110- class CuteRange (CuteSequence , metaclass = CuteRangeType ):
113+ class CuteRange (CuteSequence ):
111114 '''
112115 Improved version of Python's `range` that has extra features.
113116
@@ -121,6 +124,9 @@ class CuteRange(CuteSequence, metaclass=CuteRangeType):
121124
122125
123126 '''
127+
128+ __metaclass__ = CuteRangeType
129+
124130 def __init__ (self , * args ):
125131 self .start , self .stop , self .step = parse_range_args (* args )
126132
0 commit comments