checking if a list is empty
Hans Georg Schaathun
hg at schaathun.net
Thu May 12 02:23:20 EDT 2011
On 11 May 2011 21:42:10 GMT, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> 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
More information about the Python-list
mailing list