Question about idioms for clearing a list

Bryan Olson fakeaddress at nowhere.org
Fri Feb 10 06:05:56 EST 2006


Raymond Hettinger wrote:
[...]
> If you're asking why list's don't have a clear() method, the answer is
> that they already had two ways to do it (slice assignment and slice
> deletion) and Guido must have valued API compactness over collection
> polymorphism.

That's a decision from long ago. Now that we have sets and
the iterable protocol, the case is quite different.


-- 
--Bryan



More information about the Python-list mailing list