GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codeql/python/ql/src/Classes/EqualsOrNotEquals.py at main · max2max4u/codeql Expand file tree/ Copy pathEqualsOrNotEquals.pyMore file actions 32 lines (22 loc) · 863 Bytes / Copy pathEqualsOrNotEquals.pyFile metadata and controls32 lines (22 loc) · 863 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 class PointOriginal(object): def __init__(self, x, y): self._x, x self._y = y def __repr__(self): return 'Point(%r, %r)' % (self._x, self._y) def __eq__(self, other): # Incorrect: equality is defined but inequality is not if not isinstance(other, Point): return False return self._x == other._x and self._y == other._y class PointUpdated(object): def __init__(self, x, y): self._x, x self._y = y def __repr__(self): return 'Point(%r, %r)' % (self._x, self._y) def __eq__(self, other): if not isinstance(other, Point): return False return self._x == other._x and self._y == other._y def __ne__(self, other): # Improved: equality and inequality method defined (hash method still missing) return not self == other |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |