suppose you have:
class F:
pass
then you make an instance:
g=F()
how can i check if the instance g is derived from the main class F?
You can do this:
if isinstance(obj, MyClass):
print "obj is my object"
So for your example:
if isinstance(g, F):
print "obj is my object"
Use this at your peril, sometimes it's Easier to Ask Forgiveness than Permission.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With