Skip to content

Commit

Permalink
docs/more_types: Fix typso in advanced self-types (#8006)
Browse files Browse the repository at this point in the history
* docs/more_types: Fix typo in advanced self-types

The type of self should be `Tag[str]` here.

* docs/more_types: Fix a typo in Tag.export example

The `export` methods seems to actually return an `str` instead of `T`
even when a converter is given.
  • Loading branch information
suutari authored and ilevkivskyi committed Nov 25, 2019
1 parent 20b60b5 commit 2af0ac0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/source/more_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ for certain values of type arguments:
class Tag(Generic[T]):
item: T
def uppercase_item(self: C[str]) -> str:
def uppercase_item(self: Tag[str]) -> str:
return self.item.upper()
def label(ti: Tag[int], ts: Tag[str]) -> None:
Expand Down Expand Up @@ -621,7 +621,7 @@ some tricky methods:
@overload
def export(self: Tag[str]) -> str: ...
@overload
def export(self, converter: Callable[[T], str]) -> T: ...
def export(self, converter: Callable[[T], str]) -> str: ...
def export(self, converter=None):
if isinstance(self.item, str):
Expand Down

0 comments on commit 2af0ac0

Please sign in to comment.