On Monday, September 12, 2016 at 5:21:51 PM UTC-4, Thomas 'PointedEars' Lahn 
wrote:
> Chris Angelico wrote:
> 
> > On Mon, Sep 12, 2016 at 9:14 PM, Daiyue Weng <daiyuew...@gmail.com> wrote:
> > If you know that 'errors' is always going to be a list, you can check
> > for emptiness thus:
> > 
> > if not errors:
> 
> 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:
> 
> Only if I did not know that I would use the “not” keyword, because the 
> latter
> 
>   a) forces a type conversion to “bool”;
>   b) also works with values of other types.

Why do you object to the type conversion to bool?

--Ned.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to