[Python-ideas] clear() method for lists

Raymond Hettinger raymond.hettinger at gmail.com
Fri Feb 12 23:35:25 CET 2010

On Feb 12, 2010, at 2:33 PM, Greg Ewing wrote:

> Masklinn wrote:
>> Though I'm not sure it's a very good idea for lists. Semantically, lists
> > are to be iterated, not really to be indexed.
> I don't think I agree that lists are meant primarily for
> iteration. Indexing them is a perfectly legitimate and
> useful thing to do.
> However, I would agree that a list.get() operation with a
> default seems to be a rather rare requirement. Usually
> when you index a list, the index is generated by some
> algorithm that guarantees it's within range.
> I can't remember ever wanting a list.get() myself, and
> if I ever did, I would be quite happy to write my own.

I concur. Put me down for a -1.

Also, I think this idea was discussed once or twice here
before and it got shot down then too. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100212/4c9eac4c/attachment.html>

More information about the Python-ideas mailing list