[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.239,2.240
Guido van Rossum
gvanrossum@users.sourceforge.net
2001年10月07日 13:54:14 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv13870
Modified Files:
bltinmodule.c
Log Message:
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).
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.239
retrieving revision 2.240
diff -C2 -d -r2.239 -r2.240
*** bltinmodule.c 2001年09月13日 21:49:44 2.239
--- bltinmodule.c 2001年10月07日 20:54:12 2.240
***************
*** 1642,1649 ****
static char isinstance_doc[] =
! "isinstance(object, class-or-type) -> 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.";
--- 1642,1651 ----
static char isinstance_doc[] =
! "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.\n\
! The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for\n\
! isinstance(x, A) or isinstance(x, B) or ... (etc.).";