jab on master
minor improvements to docs, CI,… (compare)
BidirectionalMapping.inversesuch that the type of any subclass
Bis inferred correctly as
B[VT, KT]– I don't think it's currently possible to compose type variables such that mypy understands this.)
def foo(self: B) -> B[VT, KT]: ...?
inverseproperty", that may be true, but
inverseaccounts for an outsized share of a bidict's value, since it is not only a view of the inverse bidict, but also the main interface for getting and setting keys by value on the forward bidict. So I think the proposal to "type hint everything but
inverse" (in a way that is understandable by mypy without any custom plugins) might provide a lot less value than you expect.
inverseproperty would still get a lot of value out of the rest of its implementation of the
MutableMappinginterface, since it enforces the uniqueness of values constraint.