In simplest terms what I want is a tuple
with one or two additional methods. __new__
or __init__
are not going to be modified.
I would like to create an abstract base class that is subclass of collections.abc.Sequence
. Then I want to use it for what is basically a tuple
subclass. The class diagram is something like:
collections.abc.Sequence
/ \
/ \
/ \
MyABC tuple
\ /
\ /
\ /
MyClass
Reasons:
MyABC
defines some custom interfaces. It is there so third parties are not forced to subclassMyClass
.tuple
is needed for its performance and the already implemented methods.
Questions:
- Is the idiomatic way just to write
class MyClass(MyABC, tuple)
or should I play with the registers? - Are there any other obvious problems that I am missing?
- Will the space and performance benefits of
tuple
be lost because of the subclassing?