Daiyue Weng <daiyuew...@gmail.com> writes:

> Hi, I found that when I tried to make an equality test on empty like,
>
> if errors == []:
>
> PyCharm always warns me,
>
> Expression can be simplified.
>
> I am wondering what's wrong and how to fix this?
>
It is not wrong, but it can be simplified to just:

if errors:

This is quite usual in Python, but some people prefer the more elaborate form, 
or something like:

if len(errors) == 0:
-- 
Piet van Oostrum <pie...@pietvanoostrum.com>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to