Indicate PEP 483 is sloppy about type vs. class.

This commit is contained in:
Guido van Rossum 2015-06-05 08:09:16 -07:00
parent 1f813b8347
commit 6b0c7a8ed8
1 changed files with 8 additions and 3 deletions

View File

@ -106,15 +106,20 @@ Notational conventions
- X, Y etc. are type variables (defined with TypeVar(), see below). - X, Y etc. are type variables (defined with TypeVar(), see below).
- C, D etc. are classes defined with a class statement. - C, D etc. are classes defined with a class statement.
- x, y etc. are objects or instances. - x, y etc. are objects or instances.
- We use the terms type and class interchangeably, and we assume
type(x) is x.\_\_class\_\_. - We use the terms type and class interchangeably. Note that PEP 484
makes a distinction (a type is a concept for the type checker,
while a class is a runtime concept). In this PEP we're only
interested in the types anyway, and if this bothers you, you can
reinterpret this PEP with every occurrence of "class" replaced by
"type".
General rules General rules
------------- -------------
- Instance-ness is derived from class-ness, e.g. x is an instance of - Instance-ness is derived from class-ness, e.g. x is an instance of
t1 if type(x) is a subclass of t1. t1 if the type of x is a subclass of t1.
- No types defined below (i.e. Any, Union etc.) can be instantiated. - No types defined below (i.e. Any, Union etc.) can be instantiated.
(But non-abstract subclasses of Generic can be.) (But non-abstract subclasses of Generic can be.)
- No types defined below can be subclassed, except for Generic and - No types defined below can be subclassed, except for Generic and