Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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



Beautiful, this does the trick!! Thanks for the tip.

  @ai()
  def stub() -> int:
      """docstring"""
      ...

  # (use ... instead of "pass" in the function body)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: