[Python-ideas] clear() method for lists

Andre Roberge andre.roberge at gmail.com
Sat Apr 4 01:36:46 CEST 2009


On Fri, Apr 3, 2009 at 8:33 PM, Ben Finney
<ben+python at benfinney.id.au<ben%2Bpython at benfinney.id.au>
> wrote:

> George Sakkis <george.sakkis at gmail.com> writes:
>
> > On Fri, Apr 3, 2009 at 6:53 AM, Andre Roberge <andre.roberge at gmail.com>
> wrote:
> >
> > > On the general Python list, a suggestion was made to add a clear()
> method to
> > > list, as the "obvious" way to do
> > > del some_list[:]
> > > or
> > > some_list[:] = []
> >
> > It's obviously more explicit, but at the same it's a rather
> > infrequent operation and the current ways are not particularly ugly.
>
> More than explicit, it would make ‘clear’ the One Obvious Way To Do It
> for base collection types. +1 from me.
>

Seeing mostly positive responses so far ... Is it worth writing a pre-PEP to
formalize this suggestion?

André



>
> --
>  \          “It's a good thing we have gravity or else when birds died |
>  `\             they'd just stay right up there. Hunters would be all |
> _o__)                                        confused.” —Steven Wright |
> Ben Finney
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090403/755508c1/attachment.html>


More information about the Python-ideas mailing list