list.clear() missing?!?

Alan Morgan amorgan at xenon.Stanford.EDU
Wed Apr 12 18:36:47 EDT 2006


In article <1144870852.886477.238570 at u72g2000cwu.googlegroups.com>,
Raymond Hettinger <python at rcn.com> wrote:
>[Steven Bethard]
>> 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?
>
>Something this small doesn't need a PEP.  I'll just send a note to
>Guido asking for a pronouncement.
>
>Here's a draft list of pros and cons (any changes or suggestions are
>welcome):
>
>Pros:
>-----
>
>* s.clear() is more obvious in intent

Serious question: Should it work more like "s=[]" or more like
"s[:]=[]".  I'm assuming the latter, but the fact that there is
a difference is an argument for not hiding this operation behind
some syntactic sugar. 

Alan
-- 
Defendit numerus



More information about the Python-list mailing list