[Python-checkins] peps: Clarify isinstance(x, Callable). Drop reference to isinstance() implementation.

guido.van.rossum python-checkins at python.org
Fri Jun 5 17:09:24 CEST 2015


https://hg.python.org/peps/rev/6ddcdb4644f6
changeset:   5893:6ddcdb4644f6
user:        Guido van Rossum <guido at python.org>
date:        Fri Jun 05 08:08:43 2015 -0700
summary:
  Clarify isinstance(x, Callable). Drop reference to isinstance() implementation.

files:
  pep-0484.txt |  9 +++++++--
  1 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/pep-0484.txt b/pep-0484.txt
--- a/pep-0484.txt
+++ b/pep-0484.txt
@@ -85,8 +85,8 @@
 ---------
 
 While the proposed typing module will contain some building blocks for
-runtime type checking -- in particular a useful ``isinstance()``
-implementation -- third party packages would have to be developed to
+runtime type checking -- in particular the `get_type_hints()`
+function -- third party packages would have to be developed to
 implement specific runtime type checking functionality, for example
 using decorators or metaclasses.  Using type hints for performance
 optimizations is left as an exercise for the reader.
@@ -262,6 +262,11 @@
 specifying callback signatures with a variable number of argument of a
 specific type.
 
+Because `typing.Callable` does double-duty as a replacement for
+`collections.abc.Callable`, `isinstance(x, typing.Callable)` is
+implemented by deferring to `isinstance(x, collections.abc.Callable)`.
+However, `isinstance(x, typing.Callable[...])` is not supported.
+
 
 Generics
 --------

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list