Hacker News new | ask | show | jobs
by _ZeD_ 1877 days ago
it's not the same, but it's almost idiomatic to leave unfinished python code with "..." (the ellipsis object)

    def foo(bar, baz):
        ...
is a valid (empty) python function
3 comments

Yeah, but this is best used for abstract methods or type stubs. I think in 'real code' you would want to raise NotImplementedError, or even (if you use mypy) potentially return a NoReturn

ie: from typing import Any, NoReturn

    def foo(bar: Any, baz: Any) -> NoReturn:
        raise NotImplementedError
Oh, interesting. I’ve always used “pass” for this.
Perl has ellipsis which will die on use.