Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

equality of objects [python]

Name: Anonymous 2011-01-13 14:13

If we have a classes, that have the same interface and can be used only in the same way, then aren't they the same classes?

If we have objects, that have the same state and have the same interface, then aren't they the same objects?

Look:

class X:
    def foo(self):
        return 1

class Y:
    def foo(self):
        return 1

a = X()
b = Y()
c = Y()
print X == Y
print a == b
print b == c


False
False
False

Name: Anonymous 2011-01-13 14:45

>>3
Then how classes should/may be compared?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List