order of test
Fredrik Lundh
fredrik at pythonware.com
Mon Jul 29 12:07:06 EDT 2002
William Dode wrote:
> can we be sure of the order of a test expression ?
> i mean that
> t=["one","two"]
> x=10
> if x<2 and t[x]=="oups":
>
> will never throw an exception if t[2] will be tested before x<2
when in doubt, consult the language reference:
http://www.python.org/doc/current/ref/ref.html
=> expressions => boolean operations
"The expression 'x and y' first evaluates x; if x is false,
its value is returned; otherwise, y is evaluated and the
resulting value is returned."
</F>
More information about the Python-list
mailing list