1 or 1/0 doesn't raise an exception
Rohannes
ronen.agranat at gmail.com
Sun Dec 14 05:32:41 EST 2008
'Dive into Python' has a very memorable and interesting section on the
exact behaviour of 'and' and 'or' in Python:
http://diveintopython.org/power_of_introspection/and_or.html
> No: &, | (and ^, too) perform bitwise operations in Python, C and Java:
"In complete evaluation ... both expressions are always evaluated. To
obtain complete evaluation in Java, you use & rather than && ... and
use | in place of ||" - Walter Savitch, Absolute Java 2nd ed.
Although & IS the bitwise-AND operator in Java:
http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html
I guess it's a matter of context.
More information about the Python-list
mailing list