From 1f813b83476bbdd1f3c9cacb737290c721be5d75 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 5 Jun 2015 08:08:43 -0700 Subject: [PATCH] Clarify isinstance(x, Callable). Drop reference to isinstance() implementation. --- pep-0484.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt index b575f4071..c22047337 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -85,8 +85,8 @@ Non-goals --------- 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 @@ arguments with ``Callable``. Similarly, there is no support for 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 --------