diff --git a/docs/source/cheat_sheet.rst b/docs/source/cheat_sheet.rst index b93a0632b031..49919a56831c 100644 --- a/docs/source/cheat_sheet.rst +++ b/docs/source/cheat_sheet.rst @@ -134,7 +134,6 @@ When you're puzzled or when things are complicated # type: (*str, **str) -> str request = make_request(*args, **kwargs) return self.do_api_query(request) - # Use `ignore` to suppress type-checking on a given line, when your # code confuses mypy or runs into an outright bug in mypy. diff --git a/docs/source/cheat_sheet_py3.rst b/docs/source/cheat_sheet_py3.rst index 964e78ec1b2d..adeab7d734d4 100644 --- a/docs/source/cheat_sheet_py3.rst +++ b/docs/source/cheat_sheet_py3.rst @@ -122,6 +122,12 @@ When you're puzzled or when things are complicated # dynamic to write a type for. x = mystery_function() # type: Any + # This is how to deal with varargs. + # This makes each positional arg and each keyword arg a 'str'. + def call(self, *args: str, **kwargs: str) -> str: + request = make_request(*args, **kwargs) + return self.do_api_query(request) + # Use `ignore` to suppress type-checking on a given line, when your # code confuses mypy or runs into an outright bug in mypy. # Good practice is to comment every `ignore` with a bug link