Re: [Python-ideas] Set Syntax

Hi -- thought I'd chime in on this one:
Note that dictionaries and sets have clear() methods:
Deques have this method as well:
If lists had the clear() method, then the basic collection objects would be in alignment. -- Gerald Britton

On Mon, Nov 22, 2010 at 8:02 AM, Gerald Britton <gerald.britton@gmail.com> wrote: <snip>
Possible objection: Violates TOOWTDI. There are already 2 ways to clear a list: del lst[:] lst[:] = [] Do we necessarily need a third? Unlike lists, dicts, sets, and deques don't support slice subscripts, which is arguably the only reason they need .clear() methods. Also, is it that common to treat such significantly differently collection types generically? Cheers, Chris -- http://blog.rebertia.com

On Tue, 23 Nov 2010 11:08:45 -0800 Chris Rebert <pyideas@rebertia.com> wrote:
Also, is it that common to treat such significantly differently collection types generically?
What's common - or at least not unknown - is for the changing nature of a problem to dictate that you change which collection type you're using. The more methods they share, the easier making that change is. <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

On 11/23/2010 2:59 PM, Guido van Rossum wrote:
FWIW I'm fine with adding list.clear() to 3.3.
http://bugs.python.org/issue10516 -- Terry Jan Reedy

On Mon, Nov 22, 2010 at 8:02 AM, Gerald Britton <gerald.britton@gmail.com> wrote: <snip>
Possible objection: Violates TOOWTDI. There are already 2 ways to clear a list: del lst[:] lst[:] = [] Do we necessarily need a third? Unlike lists, dicts, sets, and deques don't support slice subscripts, which is arguably the only reason they need .clear() methods. Also, is it that common to treat such significantly differently collection types generically? Cheers, Chris -- http://blog.rebertia.com

On Tue, 23 Nov 2010 11:08:45 -0800 Chris Rebert <pyideas@rebertia.com> wrote:
Also, is it that common to treat such significantly differently collection types generically?
What's common - or at least not unknown - is for the changing nature of a problem to dictate that you change which collection type you're using. The more methods they share, the easier making that change is. <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

On 11/23/2010 2:59 PM, Guido van Rossum wrote:
FWIW I'm fine with adding list.clear() to 3.3.
http://bugs.python.org/issue10516 -- Terry Jan Reedy
participants (9)
-
average
-
Boris Borcic
-
Chris Rebert
-
Gerald Britton
-
Guido van Rossum
-
Masklinn
-
Mike Graham
-
Mike Meyer
-
Terry Reedy