]> granicus.if.org Git - python/commitdiff
Follow current recommended practice in an example: Use isinstance() to
authorFred Drake <fdrake@acm.org>
Sun, 11 Jan 1998 21:15:23 +0000 (21:15 +0000)
committerFred Drake <fdrake@acm.org>
Sun, 11 Jan 1998 21:15:23 +0000 (21:15 +0000)
perform a type test instead of type(x) == types.FoobarType.  In example
for type().

Doc/lib/libfuncs.tex
Doc/libfuncs.tex

index 51edb331e167911658b08b038f45ac1ffdb34b56..36582da0af6e418a7808c303b5c0e9f003cd1b54 100644 (file)
@@ -606,7 +606,7 @@ For instance:
 
 \bcode\begin{verbatim}
 >>> import types
->>> if type(x) == types.StringType: print "It's a string"
+>>> if isinstance(x, types.StringType): print "It's a string"
 \end{verbatim}\ecode
 \end{funcdesc}
 
index 51edb331e167911658b08b038f45ac1ffdb34b56..36582da0af6e418a7808c303b5c0e9f003cd1b54 100644 (file)
@@ -606,7 +606,7 @@ For instance:
 
 \bcode\begin{verbatim}
 >>> import types
->>> if type(x) == types.StringType: print "It's a string"
+>>> if isinstance(x, types.StringType): print "It's a string"
 \end{verbatim}\ecode
 \end{funcdesc}