On May 5, 11:36 pm, Jabba Laci <jabba.l...@gmail.com> wrote: > Hi, > > If I want to check if a list is empty, which is the more pythonic way? > > li = [] > > (1) if len(li) == 0: > ... > or > (2) if not li:
The Python core developers use the second form. See http://www.python.org/dev/peps/pep-0008/ for the official recommendation. Raymond -- http://mail.python.org/mailman/listinfo/python-list