[Patches] [ python-Patches-456949 ] clear() method for lists
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 30 Aug 2001 12:13:24 -0700
Patches item #456949, was opened at 2001-08-30 12:03
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=456949&group_id=5470
Category: core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tomas Styblo (tripiecz)
Assigned to: Nobody/Anonymous (nobody)
Summary: clear() method for lists
Initial Comment:
Hello.
A patch which adds the clear() method to lists is
appended to this message. It's for the current CVS of
listobject.c.
Motivation:
- Dictionaries have this method. For sake of
consistence, lists should have it too.
- Python 2.2 attempts to somewhat unify interface
to dictionaries and interface to lists: iterators and
compatibility of the 'in' operator with dictionaries
are good examples.
- 'L.clear()' is far more readable then 'del L[:]'
- Lists in Java have it too. :-)
- It was easy to implement, there already exists
tp_clear for lists.
Any objections against the patch ?
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-30 12:13
Message:
Logged In: YES
user_id=6380
The consistency argument is bogus -- the APIs for lists and
dicts are almost entirely distinct.
The tp_clear slot is for internal use by the garbage
collector.
Rejected.
If you want to help, please search through PEP 42 for
projects.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=456949&group_id=5470