list.clear() missing?!?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Thu Apr 13 07:16:22 EDT 2006


On Thu, 13 Apr 2006 07:49:11 +0000, Duncan Booth wrote:

> Raymond Hettinger wrote:
> 
>> Cons:
>> -----
>> 
>> * learning slices is basic to the language (this lesson shouldn't be
>> skipped)
>> 
> also, a clear method would simply clear the entire list. You still need to 
> learn the assigning to/deleting slices technique any time you want to clear 
> out part of a list.

A clear method does not *necessarily* clear only the entire list. That's
an choice that can be made. I for one would vote +1 for clear taking an
optional index or slice, or two indices, to clear only a part of the list.



-- 
Steven.




More information about the Python-list mailing list