This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients eli.bendersky, eric.araujo, eric.smith, georg.brandl, giampaolo.rodola, rhettinger, terry.reedy, xuanji
Date 2010-11-27.13:29:18
SpamBayes Score 1.7985613e-14
Marked as misclassified No
Message-id <1290864560.44.0.354643131613.issue10516@psf.upfronthosting.co.za>
In-reply-to
Content
Attaching a patch for list.clear():

1. Implements a new function in Objects/listobject.c named listclear() (to be consistent with the other "method functions")
2. listclear() is registered in list_methods and just calls list_clear(), returning None
3. A documentation string is modeled after dict.clear(), but shaped a bit differently to follow the conventions of other list method docs.

If this look fine to the more experienced devs, things left to do are:

1. Add tests
2. Implement the .copy() method in a similar manner + tests for it

Some random observations:

1. The naming of functions/methods could be made more consistent. See, for example, list_reversed vs. listreverse.
2. The documentation style of list and dict methods is different for no apparent reason:

help({}.pop) gives:

pop(...)
    D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
    If key is not found, d is returned if given, otherwise KeyError is raised

While help([].pop) gives:

pop(...)
    L.pop([index]) -> item -- remove and return item at index (default last).
    Raises IndexError if list is empty or index is out of range.

Note the '--' which separates the signature from description in the list version.
History
Date User Action Args
2010-11-27 13:29:20eli.benderskysetrecipients: + eli.bendersky, georg.brandl, rhettinger, terry.reedy, eric.smith, giampaolo.rodola, eric.araujo, xuanji
2010-11-27 13:29:20eli.benderskysetmessageid: <1290864560.44.0.354643131613.issue10516@psf.upfronthosting.co.za>
2010-11-27 13:29:18eli.benderskylinkissue10516 messages
2010-11-27 13:29:18eli.benderskycreate