2 ms·
> Yeah the pyright doesn't like the annotated return type not being honored by the empty stub function. I wonder if there's a way to trick it. Python has an ex
by dragonwriter 3y ago
> Yeah the pyright doesn't like the annotated return type not being honored by the empty stub function. I wonder if there's a way to trick it.
Python has an existing convention for this (so its not a "trick"), the use of the special value Ellipsis (literal: ...)
https://mypy.readthedocs.io/en/stable/stubs.html https://mypy.readthedocs.io/en/stable/stubs.html
- deleted 3y ago[deleted]
- edunteman 3y agoBeautiful, this does the trick!! Thanks for the tip. @ai() def stub() -> int: """docstring""" ... # (use ... instead of "pass" in the function body)
- deleted 3y ago[deleted]