[New-bugs-announce] [issue10516] Add list.clear()

Terry J. Reedy report at bugs.python.org
Wed Nov 24 00:37:48 CET 2010

New submission from Terry J. Reedy <tjreedy at udel.edu>:

Add list.clear() method with obvious semantics.

1. parallel to set/dict/defaultdict/deque.clear(),
   usable in generic mutable collection function;
2. makes it easier to switch between list and other collection class;
3. current alternatives are not as obvious;
4. some people seem to expect it.

1. unneeded; del l[:] or l[:]=[] do same already.

Guido: (python-ideas list, 'Set Syntax' thread, today)
"FWIW I'm fine with adding list.clear() to 3.3."

components: Interpreter Core
messages: 122251
nosy: terry.reedy
priority: normal
severity: normal
stage: unit test needed
status: open
title: Add list.clear()
type: feature request
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list