3 ms·
I find that the testing for empty is a bit misguided if you want to be rigorous with types. for instance: >>>def isempty(l): >>> return not bool(l
by msl09 12y ago
I find that the testing for empty is a bit misguided if you want to be rigorous with types.
for instance:
>>>def isempty(l):
>>> return not bool(l)
>>>isempty([])
True
>>>isempty(None)
True
If embedded within your program logic this kind of pattern can waste precious time with debugging. You can catch your errors much more quickly if you are explicit with your comparisons.