Classmethods in Generic Protocols with self-types, mypy type checking failure
问题 A little background, I essentially need to define an int wrapper type, say MyInt (among some other classes), and another generic Interval type which can accept MyInt objects as well as other types of objects. Since the types acceptable by the Interval do not fall into a neat hierarchy, I thought this would be a perfect use-case for the experimental Protocol , which in my case would require a couple of methods and a couple of @classmethod s. All the methods return a "self-type", i.e., MyInt.my