Type checking of arguments Python
>>> isinstance('a', str)
True
>>> isinstance(n, Node)
True
Use isinstance()
. Sample:
if isinstance(n, unicode):
# do this
elif isinstance(n, Node):
# do that
...
>>> isinstance('a', str)
True
>>> isinstance(n, Node)
True
Use isinstance()
. Sample:
if isinstance(n, unicode):
# do this
elif isinstance(n, Node):
# do that
...