coady / multimethod

Multiple argument dispatching.
https://coady.github.io/multimethod
Other
284 stars 23 forks source link

eql specializers / `Literal` types #48

Closed remexre closed 3 years ago

remexre commented 3 years ago

If one tries to specialize on an argument with a Literal[_] type, they get TypeError: typing.Literal cannot be used with issubclass(). It'd be nice to have support for this; I suspect patching issubclass to add the following rules would work:

coady commented 3 years ago

Duplicate of #44. As of 5f4bf2a, literals are partially supported. The params will participate as a subclass check (but not actually check the literal values).