[issue10516] Add list.clear() and list.copy()
Eli Bendersky
report at bugs.python.org
Sat Nov 27 11:09:03 CET 2010
Eli Bendersky <eliben at gmail.com> added the comment:
Objects/listobject.c has a static function named list_clear used internally. Is it possible to just expose this function as a clear() method?
One problem is that it has this strange comment in the end:
/* Never fails; the return value can be ignored.
Note that there is no guarantee that the list is actually empty
at this point, because XDECREF may have populated it again! */
However, looking at the code I'm not sure the list can be cleared any more than the function does, and it actually deallocates the ob_item field of the list.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10516>
_______________________________________
More information about the Python-bugs-list
mailing list