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?
#untested & unbenchmarked since it's 1am offset = 0 for index in indices_to_delete: del x[index-offset] offset += 1 Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list