{ "metadata": { "name": "", "signature": "sha256:ae2b8518f887d990268dd6706366d86c59a8cf8275d6834ab9826b4bead10cdd" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "##TL;DR\n", "No." ] }, { "cell_type": "code", "collapsed": false, "input": [ "class A:\n", " def __init__(self, a):\n", " self.a = a\n", " def __ge__(self,other):\n", " return self.a >= other.a\n", " def __le__(self,other):\n", " return self.a <= other.a" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 13 }, { "cell_type": "code", "collapsed": false, "input": [ "class A:\n", " def __init__(self, a):\n", " self.a = a\n", " def __eq__(self,other):\n", " return self.a==other.a\n", " def __gt__(self,other):\n", " return self.a > other.a\n", " def __lt__(self,other):\n", " return self.a < other.a" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 26 }, { "cell_type": "code", "collapsed": false, "input": [ "a = A(1)\n", "b = A(2)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 27 }, { "cell_type": "code", "collapsed": false, "input": [ "print a < b, True\n", "print a <= b, True\n", "print a == b, False\n", "print a > b, False\n", "print a >= b, False" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "True True\n", "False True\n", "False False\n", "False False\n", "True False\n" ] } ], "prompt_number": 28 }, { "cell_type": "code", "collapsed": false, "input": [ "a = A(1)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 29 }, { "cell_type": "code", "collapsed": false, "input": [ "print a < b, True\n", "print a <= b, True\n", "print a == b, False\n", "print a > b, False\n", "print a >= b, False" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "True True\n", "True True\n", "False False\n", "False False\n", "False False\n" ] } ], "prompt_number": 30 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }