Follow current recommended practice in an example: Use isinstance() to
perform a type test instead of type(x) == types.FoobarType. In example for type().
This commit is contained in:
parent
48022db400
commit
fd49a964bc
|
@ -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}
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
|
Loading…
Reference in New Issue