<div class="gmail_quote">On Wed, Sep 23, 2009 at 3:48 AM, Peter Otten <span dir="ltr"><__<a href="mailto:peter__@web.de">peter__@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Why's that obsession with speed?<br></blockquote><div><br>Well, most of the solutions posted so far are O(n**2), which may be noticeably slow if the list is of considerable length.  I wonder if the original poster ran in to that problem.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>>> items = ["a", "b", "c", "d"]<br>
>>> delenda = set([0, 3])<br>
>>> items = [item for index, item in enumerate(items) if index not in
delenda]<br>
>>> items<br>
['b', 'c']</blockquote><div><br>... except for that one.  That's O(n).  Very nice. :-)<br></div></div><blockquote style="margin: 1.5em 0pt;">--<br>
Daniel Stutzbach, Ph.D.<br>
President, <a href="http://stutzbachenterprises.com">Stutzbach Enterprises, LLC</a>
</blockquote>