Here's a nice little use of type/class unification: instead of using: if type(x) is type(0): we can use: if type(x) is int: or, for type checking.. assert type(num) is int assert type(msg) is str ( I assume the use of 'is', rather than '==', is acceptable here ) ..much prettier.