checking if a list is empty

Chris Rebert clp2 at rebertia.com
Fri May 6 16:46:14 EDT 2011


On Fri, May 6, 2011 at 1:05 PM, Adam Tauno Williams
<awilliam at whitemice.org> wrote:
<snip>
> - and ignore the Pythonistas [they're nuts;  that x.count() doesn't work
> is amazingly stupid].

Eh? It works fine. [5, 2, 2, 1, 2].count(2) == 3. If you mean you want
len(x) to be spelled x.count(), that's equally stupid; `count` would
be a lousy name (people would confuse it with what the current
.count() does). `length` or `size` would make much more sense.

Cheers,
Chris



More information about the Python-list mailing list