Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guides/writing_stubs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ This avoid forcing the user to check for ``None``::
match = re.fullmatch(r"\d+_(.*)", some_string)
assert match is not None
name_group = match.group(1) # The user knows that this will never be None
return name_group.uper() # This typo will be flagged by the type checker
name_group.uper() # This typo will be flagged by the type checker

In this case, the user of ``match.group()`` must be prepared to handle a ``str``,
but type checkers are happy with ``if name_group is None`` checks, because we're
Expand Down