On 6/30/2012 5:35 PM, Thomas Jollans wrote:
On 06/30/2012 11:07 PM, Alain Ketterlin wrote:
Thomas Jollans <t...@jollybox.de> writes:

def is_valid_password(password):
     return mud.minpass <= len(password) <= mud.maxpass

Which of the two comparisons is done first anyway?
"In the face of ambiguity, refuse the temptation to guess."

There is no ambiguity. See the language reference:

Of course it's technically clearly defined, but the syntax isn't
explicit. To know what the order is (or whether there is an order!) one
has to consult the language reference (which shouldn't be necessary), or
make an educated guess, which would almost certainly be correct, but
we're supposed to refuse the temptation to guess, right?

Python pretty consistently evaluates expressions and equal precedence operators left to right. One really should learn that. No 'implementation defined' ambiguity.


--
Terry Jan Reedy



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to