Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: Johannes Bauer Newsgroups: comp.lang.python Subject: Re: Python3 doc, operator reflection Date: Mon, 28 Oct 2013 13:45:58 +0100 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Trace: news.dfncis.de MHMbZFojVoN3S3dzOOa6EQbW4Dc3mCO0PJemxrbrFGURLK User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: Xref: csiph.com comp.lang.python:57815 Am 28.10.2013 13:23, schrieb Chris Angelico: > On Mon, Oct 28, 2013 at 11:00 PM, Johannes Bauer wrote: >>> There are no swapped-argument versions of these methods (to be used when the left argument does not support the operation but the right argument does); rather, __lt__() and __gt__() are each other’s reflection, __le__() and __ge__() are each other’s reflection, and __eq__() and __ne__() are their own reflection. >> >> But shouldn't __lt__ be the reflection or __ge__ and __gt__ the >> reflection of __le__? > > lt is the negation of ge, but it's the reflection of gt. Consider this: > > 1 < 2 > 2 > 1 > > If Python can't ask 1 if it's less than 2, it'll ask 2 if it's greater than 1. Ah, I see. Thanks for clearing that up! Best regards, Joe