PEP 673: Fix syntax highlighting (#2435)

This commit is contained in:
Alex Waygood 2022-03-15 22:53:39 +00:00 committed by GitHub
parent dab4060126
commit 09a93fb76c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -322,7 +322,7 @@ have a ``LinkedList`` whose elements must be subclasses of the current class.
# OK
LinkedList[int](value=1, next=LinkedList[int](value=2))
# Not OK
LinkedList[int](value=1, next=LinkedList[str](value=”hello”))
LinkedList[int](value=1, next=LinkedList[str](value="hello"))
However, annotating the ``next`` attribute as ``LinkedList[T]`` allows invalid
@ -411,7 +411,7 @@ This is equivalent to writing:
::
Self = TypeVar(“Self”, bound=”Container[Any]”)
Self = TypeVar("Self", bound="Container[Any]")
class Container(Generic[T]):
value: T
@ -430,7 +430,7 @@ an object of generic type ``Container[T]``, ``Self`` is bound to
int_container: Container[int]
str_container: Container[str]
reveal_type(int_container.set_value(42)) # => Container[int]
reveal_type(str_container.set_value(“hello”)) # => Container[str]
reveal_type(str_container.set_value("hello")) # => Container[str]
def object_with_generic_type(
container: Container[T], value: T,