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
On Wed, Sep 23, 2009 at 1:25 AM, blumenkraft vohs...@gmail.com 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
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, b, c, d
Hi
2009/9/23 blumenkraft vohs...@gmail.com:
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
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 there any builtin
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.
items =
hi,is there any method to get only some elements of a list from a list of indices. Something like:indices=[0,3,6]new_list=list[indices]which would create a new list containing 0th, 3rd and 6th elements from the original list? I do this with a loop but I'd like to know if there is a simpler
On Mon, Jul 24, 2006 at 08:14:35AM -0700, Julien Ricard wrote:
hi,
is there any method to get only some elements of a list from a list of
indices. Something like:
indices=[0,3,6]
new_list=list[indices]
new_list = [list[x] for x in indicies]
which would create
indices=[0,3,6]
new_list=list[indices]
new_list = [list[x] for x in indicies]
and just as a caveat, it's generally considered bad form to
shadow the built-in list as such...
-tkc
--
http://mail.python.org/mailman/listinfo/python-list