Short-circuit Logic
Ahmed Abdulshafy
abdulshafy at gmail.com
Sun May 26 07:11:56 EDT 2013
Hi,
I'm having a hard time wrapping my head around short-circuit logic that's used by Python, coming from a C/C++ background; so I don't understand why the following condition is written this way!>
if not allow_zero and abs(x) < sys.float_info.epsilon:
print("zero is not allowed")
The purpose of this snippet is to print the given line when allow_zero is False and x is 0.
More information about the Python-list
mailing list