On 30/01/2014 14:46, Thibault Langlois wrote:
On Thursday, January 30, 2014 2:08:58 PM UTC, Roy Smith wrote:
In article <3dcdc95d-5e30-46d3-b558-afedf9723...@googlegroups.com>,
Thibault Langlois <thibault.langl...@gmail.com> wrote:
You are right. I should have given some context.
I am looking at this from the perspective of the teacher that has to explain
idiosyncrasies of the language to inexperienced students.
There are two aspects in this example.
1. the equivalence of True/False with integers 1/0 which have pro and cons.
2. the chaining rules of operators. I agree that it may make sense in some
cases like x > y > z but when operators are mixed it leads to counter
intuitive cases as the one I pointed out.
The recommendations to student are 1) do not assume True == 1 and do not use
operator chaining.
Better than that, do what I do.
1) Assume that you don't have the full operator precedence table
memorized and just parenthesize everything.
2) In cases where the expression is so simple, you couldn't possibly be
wrong, see rule #1.
Agreed !
Pleased to see that as always plenty of helpful responses here. In
return would you please read and action this
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the
double line spacing above, thanks.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list