Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57813

Re: Python3 doc, operator reflection

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'argument': 0.05; 'subject:Python3': 0.09; 'python': 0.11; '__lt__': 0.16; 'does);': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'negation': 0.16; 'rather,': 0.16; 'subject:doc': 0.16; 'wrote:': 0.18; "shouldn't": 0.24; 'mon,': 0.24; 'versions': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'charset:windows-1252': 0.65; 'reflection': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=yNmQVezn6EznSW+XIsAS1PDy6nCiA2ii9aqpxToVlVA=; b=iA7v89zODXLLOUp7y+P/ov1Z5yp3uxrhs2GdoE0kLlcaWbVhDmSNwnuC0+mP1lV94P RkrxDDPUt2vNAtOW0I/FzCh0khpv8My+PEPZf9oAnaHfrcc6O5YFFcQYVL848K04zm3u 0amNt09B0SukfePhaIzZdWlavoIk+HbTcFF7UWAY+s0HmwCfVwNU9x6YtJQZBzWMsk4o cCIrpMVtpF6ZyM+jqRt7Xjar6W2QXFW7qNsdct+EePab0t6zurkLKgWiTW6awKTN2k7x b2uGdX1AQgSk/Bjj2+rVt4Z46XS2bSzmVct6w9P/ALDp/OjEQ/U3Xepc67NDdMjg7ZI1 knGw==
MIME-Version 1.0
X-Received by 10.66.122.66 with SMTP id lq2mr1215170pab.183.1382963012348; Mon, 28 Oct 2013 05:23:32 -0700 (PDT)
In-Reply-To <bd71ueFqcsiU1@mid.dfncis.de>
References <bd71ueFqcsiU1@mid.dfncis.de>
Date Mon, 28 Oct 2013 23:23:32 +1100
Subject Re: Python3 doc, operator reflection
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1696.1382963021.18130.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382963021 news.xs4all.nl 16001 [2001:888:2000:d::a6]:46692
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57813

Show key headers only | View raw


On Mon, Oct 28, 2013 at 11:00 PM, Johannes Bauer <dfnsonfsduifb@gmx.de> 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.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python3 doc, operator reflection Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-10-28 13:00 +0100
  Re: Python3 doc, operator reflection Chris Angelico <rosuav@gmail.com> - 2013-10-28 23:23 +1100
    Re: Python3 doc, operator reflection Johannes Bauer <dfnsonfsduifb@gmx.de> - 2013-10-28 13:45 +0100
  Re: Python3 doc, operator reflection random832@fastmail.us - 2013-10-28 14:31 -0400

csiph-web