Re: Deleting more than one element from a list

2010-04-25 Thread Raymond Hettinger
On Apr 21, 12:56 pm, candide wrote: > Is the del instruction able to remove _at the same_ time more than one > element from a list ? > > For instance, this seems to be correct : > >  >>> z=[45,12,96,33,66,'c',20,99] >  >>> del z[2], z[6],z[0] >  >>> z > [12, 33, 66, 'c', 20] >  >>> > > How

Re: Deleting more than one element from a list

2010-04-21 Thread candide
Thanks for your reponses. -- http://mail.python.org/mailman/listinfo/python-list

Re: Deleting more than one element from a list

2010-04-21 Thread Emile van Sebille
On 4/21/2010 12:56 PM candide said... Is the del instruction able to remove _at the same_ time more than one element from a list ? For instance, this seems to be correct : >>> z=[45,12,96,33,66,'c',20,99] Not as I see it -- watch your index values - they change after each delete is co

Re: Deleting more than one element from a list

2010-04-21 Thread Mensanator
On Apr 21, 2:56 pm, candide wrote: > Is the del instruction able to remove _at the same_ time more than one > element from a list ? > > For instance, this seems to be correct : > >  >>> z=[45,12,96,33,66,'c',20,99] >  >>> del z[2], z[6],z[0] >  >>> z > [12, 33, 66, 'c', 20] >  >>> > > Howe

Re: Deleting more than one element from a list

2010-04-21 Thread Gary Herron
candide wrote: Is the del instruction able to remove _at the same_ time more than one element from a list ? For instance, this seems to be correct : >>> z=[45,12,96,33,66,'c',20,99] >>> del z[2], z[6],z[0] >>> z [12, 33, 66, 'c', 20] >>> However, the following doesn't work : >> z=

Re: Deleting more than one element from a list

2010-04-21 Thread Simon Brunning
On 21 April 2010 20:56, candide wrote: > Is the del instruction able to remove _at the same_ time more than one > element from a list ? Yup: >>> z=[45,12,96,33,66,'c',20,99] >>> del z[:] >>> z [] -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Deleting more than one element from a list

2010-04-21 Thread candide
Is the del instruction able to remove _at the same_ time more than one element from a list ? For instance, this seems to be correct : >>> z=[45,12,96,33,66,'c',20,99] >>> del z[2], z[6],z[0] >>> z [12, 33, 66, 'c', 20] >>> However, the following doesn't work : >> z=[45,12,96,33,66,