You can't use ABCs to modify existing classes in this way (and in fact, you can't safely modify existing classes in this way at all). ABCs are only a mechanism for customizing whether a class tests as a subclass of another (and instances of it test as instances of the other), not for actually changing subclass implementations. When the documentation talks about defining a new class "in between", this is the sense it means; it just means in between in terms of subclass/instance checks, not actual inheritance. This is described here:
ABCs introduce virtual subclasses, which are classes that don’t inherit from a class but are still recognized by
isinstance()
andissubclass()
Note what it says: the virtual subclasses don't actually inherit from your ABC, they just test as if they do. That's how ABCs are designed to work. The way to use them is suggested here:
An ABC can be subclassed directly, and then acts as a mix-in class.
So you can't modify the existing Rational class using ABC. The way to do what you want is to make a new class that inherits from Rational and uses your ABC as a mixin. Then use that class instead of the regular Rational.
In fact, you might not even really need to use ABCs here. The only advantage of using ABCs is that it makes your new rational-like numbers look like Rationals if anyone explicitly tests; but as long as you inherit from Rational and from your new class that adds the behavior you want, the new classes will act like Rationals anyway.
When you say
This is awkward, however, because existing numbers of type Rational will not have these properties.
you have targeted the essence of the situation. It might seem awkward, but it would also be mighty awkward if someone could come in and, with an ABC end-run, start modifying the behavior of your existing classes by sticking a new superclass above them in the inheritance hierarchy. That's not how it works. There is no safe way to add new behavior to existing instances of any class; the only safe thing is to add new behavior to your new class, and tell people to use that new class instead of the old class.