On 4/27/2013 5:03 PM, Roy Smith wrote:
In article <mailman.1077.1366944517.3114.python-l...@python.org>,
Chris Angelico <ros...@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.
--
http://mail.python.org/mailman/listinfo/python-list