Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44455
| From | Terry Jan Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Comparison Style |
| Date | 2013-04-27 17:40 -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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1130.1367098839.3114.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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