summaryrefslogtreecommitdiff
path: root/python/cmp.py
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-14 16:46:27 +0200
committerPatrick Simianer <p@simianer.de>2014-06-14 16:46:27 +0200
commit26c490f404731d053a6205719b6246502c07b449 (patch)
tree3aa721098f1251dfbf2249ecd2736434c13b1d48 /python/cmp.py
init
Diffstat (limited to 'python/cmp.py')
-rwxr-xr-xpython/cmp.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/cmp.py b/python/cmp.py
new file mode 100755
index 0000000..9bc6871
--- /dev/null
+++ b/python/cmp.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python2
+
+
+class A:
+ def __init__(self, a):
+ self.a = a
+
+ def __cmp__(self, b):
+ if self.a==b.a: return 0
+ return 1
+
+a = A("a")
+b = A("b")
+c = A("a")
+print a == c
+