
Dec. 26, 2021
12:13 a.m.
Guido van Rossum wrote:
Also, the only realistic use case that I have ever heard people ask for is "NOT str", as in "any sequence except str".
I've just come across another good example: an int, but not bool. Here's an example over on Discuss: https://discuss.python.org/t/contravariant-typing-type/12741/1 How does one statically enforce the rule "an int, but not bool"? Or *only* an int, no subclasses? Doing it at runtime is easy. -- Steve