Michael J. Fromberger <[EMAIL PROTECTED]>
wrote:
...
> Also, it is a common behaviour in many programming languages for logical
> connectives to both short-circuit and yield their values, so I'd argue
> that most programmers are proabably accustomed to it. The && and ||
> operators of C and its descendants also behave in this manner, as do the
Untrue, alas...:
brain:~ alex$ cat a.c
#include <stdio.h>
int main()
{
printf("%d\n", 23 && 45);
return 0;
}
brain:~ alex$ gcc a.c
brain:~ alex$ ./a.out
1
In C, && and || _do_ "short circuit", BUT they always return 0 or 1,
*NOT* "yield their values" (interpreted as "return the false or true
value of either operand", as in Python).
Alex
--
http://mail.python.org/mailman/listinfo/python-list