The expression
random.randint(1, 10) == 5
causes my linter to report the error 'Operator "==" not supported for types "int" and "Literal[0]'.
If I try to cast the comparison to an int/int one, like
random.randint(1, 10) == int(5)
It reports "Expected 0 positional arguments" for the int constructor. I figured that it must want me to explicitly label all the keyword arguments, so I tried
random.randint(1, 10) == int(x=5)
and then it reports the baffling trilogy of errors
- Operator "==" not supported for types "int" and "int" (surely comparing two integers is one of the most absolutely fundamental legitimate operations in any language?)
- Using deprecated argument x of method int() (the official docs say nothing about this being deprecated)
- Expected no arguments to int constructor .
How does it expect me to compare two ints, then? I can't find any mention of this anywhere in the docs for Python's type hinting, Pylance, the int constructor, or anything.