code review
Alain Ketterlin
alain at dpt-info.u-strasbg.fr
Sat Jun 30 17:07:41 EDT 2012
More information about the Python-list mailing list
Sat Jun 30 17:07:41 EDT 2012
- Previous message (by thread): code review
- Next message (by thread): code review
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thomas Jollans <t at 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: "Formally, if a, b, c, ..., y, z are expressions and op1, op2, ..., opN are comparison operators, then a op1 b op2 c ... y opN z is equivalent to a op1 b and b op2 c and ... y opN z, except that each expression is evaluated at most once." The last restriction (single evaluation of involved expressions) makes this a bit more than raw syntactic sugar. -- Alain.
- Previous message (by thread): code review
- Next message (by thread): code review
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list