Type checking of arguments Python [duplicate]

Use isinstance(). Sample:

if isinstance(n, unicode):
    # do this
elif isinstance(n, Node):
    # do that
...

Leave a Comment