Eli Bendersky <eli...@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 <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

Reply via email to