On Thu, 23 Dec 2004 07:27:52 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote: > On Thu, 23 Dec 2004 06:56:02 +1030, Ishwor <[EMAIL PROTECTED]> wrote: > > >>>> l > > ['a', 'b', 'c', 'd', 'e'] > >>>> for x in l[:]: > > if x == 'd': > > l.remove('d'); > > > >>>> l > > ['a', 'b', 'c', 'e'] > > This code is so clean and looks very healthy. Python will live a > > long way because its a cute language. > > imho the code is very unhealthy, i would write > l = ['a', 'b', 'c', 'd', 'e'] > l.remove('d') > print l > > btw what are you using ';' for
I am learning Python. I used 'for' specifically so that i could iterate over the list and delete the values. It was a dumb one.. thanx for pointing it out but i specifically wanted to understand how slicing work. :-) thanks anyway. -- cheers, Ishwor Gurung -- http://mail.python.org/mailman/listinfo/python-list