13 Feb
2014
13 Feb
'14
11:27 a.m.
On 02/13/2014 12:10 PM, Ben Finney wrote:
spir
writes: I think the right way is not to call the function at all, but to check it. Conceptually:
if col.is_empty(): handle_special_case() else: handle_standard_case()
Or, better from two perspectives (“empty” should normally entail “evaluates to boolean false”; and, the normal case should be the first branch from the “if”)::
if col: handle_standard_case() else: handle_empty_case()
You are right (I always forget that empty means false in python, in a logical context, which i don't find obvious at all --I wonder if any other lang follows this choice). d