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


Groups > comp.lang.python > #106687 > unrolled thread

Re: how to convert code that uses cmp to python3

Started byRandom832 <random832@fastmail.com>
First post2016-04-08 10:29 -0400
Last post2016-04-08 10:29 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#106687 — Re: how to convert code that uses cmp to python3

FromRandom832 <random832@fastmail.com>
Date2016-04-08 10:29 -0400
SubjectRe: how to convert code that uses cmp to python3
Message-ID<mailman.90.1460125759.2253.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web