Comparison Style

Roy Smith roy at panix.com
Sat Apr 27 17:03:15 EDT 2013


In article <mailman.1077.1366944517.3114.python-list at python.org>,
 Chris Angelico <rosuav at 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.



More information about the Python-list mailing list