On Thu, May 5, 2011 at 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?
Option (2), IMO. > li = [] > > (1) if len(li) == 0: > ... FYI, also equivalent: if not len(li): ... > or > (2) if not li: Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list