Eli Bendersky <eli...@gmail.com> added the comment: 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. ---------- keywords: +patch Added file: http://bugs.python.org/file19835/issue10516.1.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10516> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com