list.clear() missing?!?

Steven Bethard steven.bethard at gmail.com
Wed Apr 12 14:03:19 EDT 2006


John Salerno wrote:
> Steven Bethard wrote:
> 
>> I think these are all good reasons for adding a clear method, but 
>> being that it has been so hotly contended in the past, I don't think 
>> it will get added without a PEP.  Anyone out there willing to take out 
>> the best examples from this thread and turn it into a PEP?
> 
> What are the usual arguments against adding it?

I think most of the other folks have already given you the answers, but 
the main ones I remember:

(1) There are already at least two ways of spelling it. We don't need 
another.

(2) Clearing a list is a pretty uncommon operation. Usually just 
creating a new list is fine (and easier).

Disclaimer: I'm happy with adding list.clear(), so it's quite possible 
I'm misrepresenting the argument here.  I guess that's just all the more 
reason to have a PEP for it: to lay out all the pros and cons.

STeVe



More information about the Python-list mailing list