by emptysea · 3y ago · 0 comments
In my experience, mypy tends to be more correct and correctly understands more python code.
For example, the following won't type check in pyright (it doesn't infer the type of out):
out = []
for x in bar:
out.append(x \* 2)
return out
Edit: also pyright's vendoring of type stubs is annoying as they take precedence over downloaded type stubs.Edit2: also lack of plugins, makes using things like Pydantic less type safe compared to mypy
Narrowing on object truthiness unsure what you mean. That's intended to be supported. The out example is real difference where mypy does do better. It should at least type check on basic pyright but won't type check on strict without doing out: list[int]. That one comes from mypy has special handling for lists to allow inferring type of elements later, while pyright always infers type of a variable only based on it's declarations and never it's method calls like append.
Which isn’t very pythonic imho
Also I’m pretty sure ‘if res.ok is True’ doesn’t work
If that's not working for you you should open an issue at https://github.com/microsoft/pylance-release.