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 16:43

>>12
I rarely buy baguettes. I buy energy drinks only after a sleepless night, which happens every month or two. Only the apple juice is a staple for me.

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