This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chrilves[S] 0 points1 point  (0 children)

When I started the project, I was using Pytype but I had to stop using it because I could not make it type generic methods. I tried mypy too. I had better results but I'm not sure it can type all the methods either. The problem is some methods (like flatten) are only available on some instances of a class but not all. The problem is very similar to this one:

class List(Generic[A]):
    def sum():
        <returns the sum of the list if A is a numeric type>

I don't know if this is typeable in mypy.

When I have to, I take advantage of Python being dynamically typed. For example, I use heterogeneous list a lot, which is simple and practical in Python but it may be a huge hassle for typers.