I was trying to inherit xrange
(to implement membership testing with in
, as well as iteration). But I got the following error message:
TypeError: Error when calling the metaclass bases
type 'xrange' is not an acceptable base type
What's special about xrange
?
xrange
is implemented in C. As you can see in Tim Peters' post, there should be a convincing use case in order to justify the extra effort needed to allow subclassing of it.