list.clear() missing?!?

Steven Bethard steven.bethard at gmail.com
Wed Apr 12 11:35:27 EDT 2006


Steven D'Aprano wrote:
> On Tue, 11 Apr 2006 14:49:04 -0700, Ville Vainio wrote:
> 
>> John Salerno wrote:
>>
>>> Thanks guys, your explanations are really helpful. I think what had me
>>> confused at first was my understanding of what L[:] does on either side
>>> of the assignment operator. On the left, it just chooses those elements
>>> and edits them in place; on the right, it makes a copy of that list,
>>> right? (Which I guess is still more or less *doing* the same thing, just
>>> for different purposes)
>> Interestingly, if it was just a "clear" method nobody would be confused.
> 
> Even more importantly, you could say help(list.clear) and learn something
> useful, instead of trying help(del) and getting a syntax error.
[snip more reasons to add list.clear()]

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?

STeVe



More information about the Python-list mailing list