[Python-ideas] clear() method for lists

George Sakkis george.sakkis at gmail.com
Sat Apr 4 02:50:54 CEST 2009


On Fri, Apr 3, 2009 at 7:36 PM, Andre Roberge <andre.roberge at gmail.com> wrote:
>
>
> On Fri, Apr 3, 2009 at 8:33 PM, Ben Finney <ben+python 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?

I might be wrong on this, but I don't think there has to be a PEP for
something as small as a single simple well-defined method. A feature
request on the tracker should be enough.

George



More information about the Python-ideas mailing list