On 11/07/2011 01:01 PM, JoeM wrote:
Thanks guys, I was just looking for a one line solution instead of a
for loop if possible. Why do you consider

[x.remove(x[0]) for x in [a,b,c]]

cheating? It seems compact and elegant enough for me.



Cheers
Are you considering the possibility that two of these names might reference the same list?

a = [42, 44, 6, 19, 48]
b = a
c = b


for x in [a,b,c]:
    x.remove(x[0])

now a will have  [19,48] as its content.



--

DaveA

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to