diff options
author | Guido van Rossum <guido@python.org> | 2001-10-07 20:54:12 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-10-07 20:54:12 +0000 |
commit | 03290ecbf1661c0192e6abdbe00ae163af461d77 (patch) | |
tree | fc324d37b87c8d229d726f41de8dfc3bc33fda3a /Python/bltinmodule.c | |
parent | 1f733baa04a56eed0a5823158205fc04502e3050 (diff) | |
download | cpython-git-03290ecbf1661c0192e6abdbe00ae163af461d77.tar.gz |
Implement isinstance(x, (A, B, ...)). Note that we only allow tuples,
not other sequences (then we'd have to except strings, and we'd still
be susceptible to recursive attacks).
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 64afb1ba22..8390b7b80b 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1641,10 +1641,12 @@ builtin_isinstance(PyObject *self, PyObject *args) } static char isinstance_doc[] = -"isinstance(object, class-or-type) -> Boolean\n\ +"isinstance(object, class-or-type-or-tuple) -> Boolean\n\ \n\ Return whether an object is an instance of a class or of a subclass thereof.\n\ -With a type as second argument, return whether that is the object's type."; +With a type as second argument, return whether that is the object's type.\n\ +The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for\n\ +isinstance(x, A) or isinstance(x, B) or ... (etc.)."; static PyObject * |