On 07/02/2012 02:43 AM, Steven D'Aprano wrote: > On Sun, 01 Jul 2012 09:35:40 +0200, Thomas Jollans wrote: >> This is simply wrong. The comparisons are not acting as binary >> operators. > > Of course they are. Take this chained comparison:
Technically, yes - two-input operations are happening. Syntactically, no. Read my post. > 1) What is the operator in this expression? Is it < or == or something > else? I think I've answered this - it's the combination. > 2) What double-underscore special method does it call? Where is this > mysterious, secret, undocumented method implemented? > > 3) Why do the Python docs lie that a < b == c is exactly equivalent to > the short-circuit expression (a < b) and (b == c) with b evaluated once? > > 4) And how do you explain that the compiled byte code actually calls the > regular two-argument binary operators instead of your imaginary three- > argument ternary operator? In this context, I don't care what actually happens. I'm talking about how the code can be parsed (by the generic reader, not necessarily the python interpreter). -- http://mail.python.org/mailman/listinfo/python-list