Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!goblin3!goblin.stu.neva.ru!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.033 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'empty,': 0.09; 'to:name:python mailing list': 0.09; 'pythonic': 0.16; 'thanks,': 0.17; 'subject:list': 0.22; 'way?': 0.23; 'received:209.85.212': 0.25; 'message-id:@mail.gmail.com': 0.28; 'hi,': 0.29; 'list': 0.30; 'to:addr:python-list': 0.32; 'received:209.85': 0.37; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=v/VKVrhijlYRpQZ3ZKUhkvqRo2G9u4O22qzUi77iIgM=; b=C9qULtpbSVBcyOC4wSwUpXiMk2tHKpIkltOWklN6VkkCho0RqLE8JO+V3R6XwBgBCP 0CcP9itbwSMD1ao89sbFsyzhn4KUNFmFPZlmA/njtPErvflnSeMIBcI6ASOmciWYluGL leE3POhwtZCd/UtPWQ9tChvwjceYbOOl1C2bQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=nwJHgxFZPBkOBCjeBampqmFggXQelGY4mBA3uMKOapzBNnpW90MgOk1fkWCbvx9GTW QwNgIPpi0f6Kj7lLG/YhzVz/ABfWi1iG6RXLzlxq+qy/Xz9D21cUg0inuMdBNEThEaDJ 54xyyvhmrPtRdSg8XLX+HI0cHhc6sP1DDe40A= MIME-Version: 1.0 From: Jabba Laci Date: Fri, 6 May 2011 02:36:26 -0400 Subject: checking if a list is empty To: Python mailing list Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304663814 news.xs4all.nl 81476 [::ffff:82.94.164.166]:46591 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4799 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: ... Thanks, Laszlo