如果您不为方法 __cmp__
和 __str__
定义自己的方法会怎样?
最佳答案
If no __cmp__(), __eq__() or __ne__() operation is defined, class instances are compared by object identity (“address”).
更多详细信息:请参阅object.__cmp__(self, other) in Python .您可以获得更多引用资料 Special (magic) methods in Python .
关于Python:__cmp__ 和 __str__?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10222077/