[Python-checkins] peps: Indicate PEP 483 is sloppy about type vs. class.
guido.van.rossum
python-checkins at python.org
Fri Jun 5 17:09:22 CEST 2015
https://hg.python.org/peps/rev/2fb45655e493
changeset: 5894:2fb45655e493
user: Guido van Rossum <guido at python.org>
date: Fri Jun 05 08:09:16 2015 -0700
summary:
Indicate PEP 483 is sloppy about type vs. class.
files:
pep-0483.txt | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/pep-0483.txt b/pep-0483.txt
--- a/pep-0483.txt
+++ b/pep-0483.txt
@@ -106,15 +106,20 @@
- X, Y etc. are type variables (defined with TypeVar(), see below).
- C, D etc. are classes defined with a class statement.
- 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
-------------
- 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.
(But non-abstract subclasses of Generic can be.)
- No types defined below can be subclassed, except for Generic and
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list