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


Groups > comp.lang.python > #44455

Re: Comparison Style

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'read.': 0.03; 'compiler': 0.07; 'ugly': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'chained': 0.16; 'notation,': 0.16; 'operands': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'first.': 0.19; 'example': 0.22; 'putting': 0.22; 'header:User-Agent:1': 0.23; 'math': 0.24; "i've": 0.25; 'switch': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; "i'm": 0.30; 'assert': 0.31; 'bunch': 0.31; 'constant': 0.31; "can't": 0.35; 'done': 0.36; 'convention': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'that,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'easy': 0.60; 'received:173': 0.61; 'you.': 0.62; 'smith': 0.68; 'article': 0.77; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Jan Reedy <tjreedy@udel.edu>
Subject Re: Comparison Style
Date Sat, 27 Apr 2013 17:40:46 -0400
References <125c8f33-1a62-4dc0-9341-a2d8f7b58058@googlegroups.com> <CAPTjJmq6afVuQnXCyXNFV1QvYi_Pt2qT9tCmjBVUSvqOLunEhA@mail.gmail.com> <nqpjn81vrbluuegvj1ggvuhegdcvki6743@invalid.netcom.com> <mailman.1077.1366944517.3114.python-list@python.org> <roy-FE66BC.17031527042013@news.panix.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
In-Reply-To <roy-FE66BC.17031527042013@news.panix.com>
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1130.1367098839.3114.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367098839 news.xs4all.nl 15978 [2001:888:2000:d::a6]:50375
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44455

Show key headers only | View raw


On 4/27/2013 5:03 PM, Roy Smith wrote:
> In article <mailman.1077.1366944517.3114.python-list@python.org>,
>   Chris Angelico <rosuav@gmail.com> wrote:
>
>> If you switch the order of operands in that, the compiler won't help
>> you. Plus it "reads" wrong. So the convention is still
>> variable==constant.
>
> I just found a nice example of putting the constant first.  I've just
> done a whole bunch of ugly math to find some slice limits.  To make sure
> they're sane, I'm writing:
>
>          assert 5 <= i < j < original_song_count
>
> I can't think of any way to write that which would be as clean and easy
> to read.

Chained comparisons like this are standard math notation, which is why 
Python 'does the right thing' with them.


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


Thread

Comparison Style llanitedave <llanitedave@veawb.coop> - 2013-04-24 22:49 -0700
  Re: Comparison Style Chris Angelico <rosuav@gmail.com> - 2013-04-25 15:57 +1000
    Re: Comparison Style llanitedave <llanitedave@veawb.coop> - 2013-04-25 07:19 -0700
      Re: Comparison Style Chris Angelico <rosuav@gmail.com> - 2013-04-26 02:25 +1000
      Re: Comparison Style Steve Simmons <square.steve@gmail.com> - 2013-04-25 19:31 +0100
        Re: Comparison Style llanitedave <llanitedave@veawb.coop> - 2013-04-25 13:13 -0700
          Re: Comparison Style Neil Cerutti <neilc@norwich.edu> - 2013-04-25 20:15 +0000
          Re: Comparison Style Steve Simmons <square.steve@gmail.com> - 2013-04-25 21:35 +0100
          Re: Comparison Style Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-04-26 10:02 +0100
  Re: Comparison Style Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-25 22:37 -0400
  Re: Comparison Style Chris Angelico <rosuav@gmail.com> - 2013-04-26 12:48 +1000
    Re: Comparison Style Roy Smith <roy@panix.com> - 2013-04-27 17:03 -0400
      Re: Comparison Style Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-27 17:40 -0400
  Re: Comparison Style Dave Angel <davea@davea.name> - 2013-04-25 23:43 -0400

csiph-web