[英]How to check class equality in Python 2.5?
I've looked through Python 2.5 documentation and I couldn't find an answer to this: How do I check if an object is the same class as another object?
def IsClass(obj1, obj2):
return obj1.class == obj2.class #doesn't work
我认为您想要做的是使用类型(obj)。 :)
-编辑- 看起来他打败了我。 他对 Duck Typing 的看法是正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.