Replies: 1 comment 2 replies
-
I consider this out of scope for a static type checker. This is more of a linter feature, so you might want to reach out to the maintainers of pylint or other popular Python linters with this request. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it feasible for pyright to detect when code does something like
my_float * 2
and suggest changing2
to2.0
to take advantage of python 3.11's "Specializing Adapting Interpreter"?Multiplying a float by an int isn't a type error, so pyright shouldn't really flag this; it's out of scope. Nevertheless, for a linter to flag this kind of thing, it needs to have typechecking machinery, so I feel like this can only be accomplished by pyright or a pyright plugin.
I'm curious if anyone else has thoughts on this. Maybe a fork of pyright is the best approach, re-using as much pyright as possible, adding a diagnostic check for when
int
andfloat
types are mixed in math operators.Beta Was this translation helpful? Give feedback.
All reactions