list.clear() missing?!?

Peter Hansen peter at engcorp.com
Wed Apr 12 13:25:51 EDT 2006


Georg Brandl wrote:
> 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?
> 
> 
> That there should be one obvious way to do it.
> 
> Yes, I know that it can be debated whether "del x[:]" is obvious, and
> fortunately I'm not the one to decide <wink>.

It's so "obvious", I couldn't even find it in the tutorial the other day 
when this thread came up.  It's a wonder I ever learned that one myself, 
and I don't know where I saw it.  .clear(), on the other hand, would 
clearly be easy to add/find in the tutorial... and we'd all save time 
answering the question over and over around here (valuable time we would 
then be able to using telling people who hadn't, to go and read the 
tutorial! :-) ).


-Peter




More information about the Python-list mailing list