From what I recall, PyPy has special optimizations on built-in types like ints and lists, which is great because they are very common, and it would be wasteful to treat an int like any other object.
If I subclass int
specifically, for example
class bitset(int):
def in_bit(self, i):
return bool(self & (1 << i))
are these optimizations lost? I do not want to pre-maturely optimize, but I also don’t want to be wasteful since I can easily define a function like in_bit(b, i)
instead.