From 26c490f404731d053a6205719b6246502c07b449 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 14 Jun 2014 16:46:27 +0200 Subject: init --- python/cmp.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 python/cmp.py (limited to 'python/cmp.py') 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 + -- cgit v1.2.3