Eli Bendersky <eli...@gmail.com> added the comment:
>
> Hi, I'm also looking at listobject.c also... if we want list.clear() to
> behave exactly like del list[], we may be able to just call list_ass_slice
> on the list. Similarly for list.copy which should behave like a=l[:]
>
Note that when executed to do 'del lst[:]' (i.e. with argument v set to 0
and ilow/ihigh to the maximal range of the list), list_ass_slice will just
call list_clear anyway, which is a cue that this indeed is the right way to
do it, despite the strange comment I mentioned in my message above.
----------
Added file: http://bugs.python.org/file19834/unnamed
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10516>
_______________________________________
<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote"
style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<br>
Hi, I'm also looking at listobject.c also... if we want list.clear() to
behave exactly like del list[], we may be able to just call list_ass_slice on
the list. Similarly for list.copy which should behave like a=l[:]<br>
</blockquote></div><br>Note that when executed to do 'del lst[:]' (i.e.
with argument v set to 0 and ilow/ihigh to the maximal range of the list),
list_ass_slice will just call list_clear anyway, which is a cue that this
indeed is the right way to do it, despite the strange comment I mentioned in my
message above.<br>
<br></div>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com