How to compare to type of custom class

Viewed 8189

Say I have a custom class:

class MyClass():
    pass

and I want to test if this is an instance of MyClass. Can this be accomplished without the ugly mess of converting to a string?

str(type(MyClass())) == "<class '__main__.MyClass'>"
2 Answers
Related