Expression can be simplified on list

Thomas 'PointedEars' Lahn PointedEars at web.de
Tue Sep 13 19:16:52 EDT 2016


Chris Angelico wrote:

> […] Thomas 'PointedEars' Lahn […] wrote:
>> If I knew that it is always going to be a list or a tuple, I would check
>> its length instead:
>>
>>   if len(errors) == 0:
> 
> I wouldn't. I'd use boolification here too. Only if I had to
> distinguish between None, [], and [1,2,3], would I use a more explicit
> check (and it wouldn't be "== []", it would be probing for None).

Why (not)?

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.



More information about the Python-list mailing list