python coalesce 1

python coalesce

x = a or b	# x = a if a isn't false, else x = b

Here is what the above code is Doing:
1. If a is true, then x = a.
2. If a is false, then x = b.
3. If a is false and b is false, then x = b.

Similar Posts