Adjust ClassVar example to use pre-PEP-526 syntax. (Issue #28388)
This commit is contained in:
parent
deed0c797c
commit
7b2aa2e87c
|
@ -845,8 +845,8 @@ The module defines the following classes, functions and decorators:
|
||||||
and should not be set on instances of that class. Usage::
|
and should not be set on instances of that class. Usage::
|
||||||
|
|
||||||
class Starship:
|
class Starship:
|
||||||
stats: ClassVar[Dict[str, int]] = {} # class variable
|
stats = {} # type: ClassVar[Dict[str, int]] # class variable
|
||||||
damage: int = 10 # instance variable
|
damage = 10 # type: int # instance variable
|
||||||
|
|
||||||
:data:`ClassVar` accepts only types and cannot be further subscribed.
|
:data:`ClassVar` accepts only types and cannot be further subscribed.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue