Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!nntp.uib.no!svn.schaathun.net!not-for-mail From: Hans Georg Schaathun Newsgroups: comp.lang.python Subject: Re: checking if a list is empty Date: Thu, 12 May 2011 07:23:20 +0100 Organization: University of Bergen Lines: 16 Message-ID: References: <4dca9310$0$29980$c3e8da3$5496439d@news.astraweb.com> <4dcab8bf$0$29980$c3e8da3$5496439d@news.astraweb.com> <4dcb02b1$0$29980$c3e8da3$5496439d@news.astraweb.com> NNTP-Posting-Host: vannskorpion.bccs.uib.no X-Trace: toralf.uib.no 1305180709 11902 129.177.20.20 (12 May 2011 06:11:49 GMT) X-Complaints-To: abuse@uib.no NNTP-Posting-Date: 12 May 2011 06:11:49 GMT User-Agent: slrn/pre1.0.0-18 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5206 On 11 May 2011 21:42:10 GMT, Steven D'Aprano wrote: : *Potentially* different tests. Which is exactly the point. Given an : arbitrary object, the developer doesn't know what test is appropriate. : Should I write len(x) == 0 or list(x) == [] or x.next is None or : something else? How can I tell which is appropriate without knowing : everything about the internals of every object I ever see? Sure, but the question asked was how to check if a /list/ is empty. You defend your answer assuming a different question. You could at least have the decency to change the subject header when you go down that route. -- :-- Hans Georg