vscode python-language-serverのoptparse.pyi実装の最後に3つの(…)ドットが書かれているのはなぜですか?[複製]

Dec 09 2020

多くのプログラムのソースコードで、3つのドット(...)に遭遇することがよくあります。私はそれについてグーグルで検索しましたが、関連する答えは見つかりませんでした。なぜこれらが...メソッドの最後にPythonライブラリoptparseのソースコード実装があるのか​​疑問に思っています。これは、ライブラリのクラスの例です。

class HelpFormatter:
    def __init__(self, indent_increment: int, max_help_position: int, width: Optional[int], short_first: int) -> None: ...
    def _format__Text(self, _Text: _Text) -> _Text: ...
    def dedent(self) -> None: ...
    def expand_default(self, option: Option) -> _Text: ...
    def format_description(self, description: _Text) -> _Text: ...
    def format_epilog(self, epilog: _Text) -> _Text: ...
    def format_heading(self, heading: Any) -> _Text: ...
    def format_option(self, option: OptionParser) -> _Text: ...
    def format_option_strings(self, option: OptionParser) -> Any: ...
    def format_usage(self, usage: Any) -> _Text: ...
    def indent(self) -> None: ...
    def set_long_opt_delimiter(self, delim: _Text) -> None: ...
    def set_parser(self, parser: OptionParser) -> None: ...
    def set_short_opt_delimiter(self, delim: _Text) -> None: ...
    def store_option_strings(self, parser: OptionParser) -> None: ...

上記のコードのすべてのメソッドの最後に...ドットがあるのはなぜですか。その目的は何ですか?

これがコードの様子の画像です

回答

1 vhshunter Dec 09 2020 at 03:24

ちょっと「インターフェース」の実現だと思います。これは次のようになります。

def func():
    pass