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


Groups > comp.lang.python > #106687

Re: how to convert code that uses cmp to python3

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: how to convert code that uses cmp to python3
Date Fri, 08 Apr 2016 10:29:10 -0400
Lines 12
Message-ID <mailman.90.1460125759.2253.python-list@python.org> (permalink)
References <57064D0D.1030701@rece.vub.ac.be> <CAPTjJmrGiQS9uhFU-+TQ4nUWQ2p4gmJoQitMotS0Ob--qm1iWg@mail.gmail.com> <5706C961.2000009@rece.vub.ac.be> <CAPTjJmrbL870mV1kU8nHar=bPyKZRmhKP-8iUs_tpYVo5vhhOA@mail.gmail.com> <57075F43.7060004@rece.vub.ac.be> <85fuuw5ypl.fsf@benfinney.id.au> <5707B2CE.1010407@rece.vub.ac.be> <CAPTjJmrMv5O5vwrbfHJJCdiHi87naPOanhPmk4Ba_SLRgu1m4Q@mail.gmail.com> <1460125750.1451220.572931817.3E46D651@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de v+hcgnj5yWiCHzsyDkopwA5YG0jXr++bSUrPUp7xrLAg==
Return-Path <random832@fastmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'operator': 0.03; 'subject:code': 0.07; 'received:internal': 0.09; 'thread': 0.10; 'python': 0.10; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:compute4.internal': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:python3': 0.16; 'wrote:': 0.16; 'suggested': 0.20; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'compare': 0.27; 'fri,': 0.27; 'subject:that': 0.29; 'unlikely': 0.29; 'version,': 0.30; 'post': 0.31; 'another': 0.32; 'expensive': 0.32; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'received:66': 0.38; 'someone': 0.38; 'to:addr:python.org': 0.40; 'share': 0.61; 'header:Message-Id:1': 0.61
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=IH9+T9EOjfasuWrwdIF6h3xNw78=; b=DmOTwX 15X2ZQ7CEqZy7Gy1tEkHtkWuTZEa1C1y75X4LkOvGQ/c4i7Vu5tOtYP5XvFys/f7 sSdJ6/CxuUAFFWZ+ilbplLzHIJ3yFR3D4IkxvTckAP7ev5hXBGTYfrhtwUDKtO3z y5JHa4BquAtqxyGGJGFe6DXaIHRuG/xEQUZlg=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=IH9+T9EOjfasuWr wdIF6h3xNw78=; b=H80OD7w8b2Zn0iRgnIG5xYTGShkJKQQTki0uxyJdURucinU cWDi6ecojpYFz10JsOByofiM0wlkVm8f23s5FaGEdKQ2n/yrkz4gb0vYM1XqLUTW 4qrj4x5cHCw7AOjknFmXBxdvPx0T1HETzXlKA6DXw+rPbxuNAhK9CccxQOG0=
X-Sasl-Enc 7WN1BWpp6TbKmvg6L7bmqIMWrn+OluJJiKmeDfmCGT1w 1460125750
X-Mailer MessagingEngine.com Webmail Interface - ajax-eadf0bcf
In-Reply-To <CAPTjJmrMv5O5vwrbfHJJCdiHi87naPOanhPmk4Ba_SLRgu1m4Q@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
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>
X-Mailman-Original-Message-ID <1460125750.1451220.572931817.3E46D651@webmail.messagingengine.com>
X-Mailman-Original-References <57064D0D.1030701@rece.vub.ac.be> <CAPTjJmrGiQS9uhFU-+TQ4nUWQ2p4gmJoQitMotS0Ob--qm1iWg@mail.gmail.com> <5706C961.2000009@rece.vub.ac.be> <CAPTjJmrbL870mV1kU8nHar=bPyKZRmhKP-8iUs_tpYVo5vhhOA@mail.gmail.com> <57075F43.7060004@rece.vub.ac.be> <85fuuw5ypl.fsf@benfinney.id.au> <5707B2CE.1010407@rece.vub.ac.be> <CAPTjJmrMv5O5vwrbfHJJCdiHi87naPOanhPmk4Ba_SLRgu1m4Q@mail.gmail.com>
Xref csiph.com comp.lang.python:106687

Show key headers only | View raw


On Fri, Apr 8, 2016, at 10:08, Chris Angelico wrote:
> seq1 == seq2
> seq1 < seq2
> 
> You only need ONE comparison, and the other is presumed to be its
> opposite. When, in the Python 3 version, would you need to compare
> twice?

== might be just as expensive as the others, particularly if the
sequences are unlikely to share object identity. I suspect he chose "s1
< s2; s2 < s1" precisely because someone suggested in another post on
this thread to exclusively use the less-than operator on purity grounds.

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


Thread

Re: how to convert code that uses cmp to python3 Random832 <random832@fastmail.com> - 2016-04-08 10:29 -0400

csiph-web