Re: delete items from list by indices

2009-09-23 Thread Daniel Stutzbach
On Wed, Sep 23, 2009 at 3:48 AM, Peter Otten <__pete...@web.de> wrote: > Why's that obsession with speed? > 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. >>> item

Re: delete items from list by indices

2009-09-23 Thread blumenkraft
On 23 сен, 12:48, Peter Otten <__pete...@web.de> wrote: > blumenkraft wrote: > > I have some list: > > x = [8, 9, 1, 7] > > and list of indices I want to delete from x: > > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > > 1]. > > > What is the fastest way to do this? Is ther

Re: delete items from list by indices

2009-09-23 Thread Ishwor
Hi 2009/9/23 blumenkraft : > Hi, > > I have some list: > x = [8, 9, 1, 7] > and list of indices I want to delete from x: > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > 1]. > > What is the fastest way to do this? Is there any builtin? Try this- >>> x = [8, 9, 1, 7] >>> [x

Re: delete items from list by indices

2009-09-23 Thread Peter Otten
blumenkraft wrote: > I have some list: > x = [8, 9, 1, 7] > and list of indices I want to delete from x: > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > 1]. > > What is the fastest way to do this? Is there any builtin? Why's that obsession with speed? >>> items = ["a",

Re: delete items from list by indices

2009-09-23 Thread Chris Rebert
On Wed, Sep 23, 2009 at 1:25 AM, blumenkraft wrote: > Hi, > > I have some list: > x = [8, 9, 1, 7] > and list of indices I want to delete from x: > indices_to_delete = [0, 3], so after deletion x must be equal to [9, > 1]. > > What is the fastest way to do this? Is there any builtin? #untested &

delete items from list by indices

2009-09-23 Thread blumenkraft
Hi, I have some list: x = [8, 9, 1, 7] and list of indices I want to delete from x: indices_to_delete = [0, 3], so after deletion x must be equal to [9, 1]. What is the fastest way to do this? Is there any builtin? Thanks. -- http://mail.python.org/mailman/listinfo/python-list