Le 07/11/2011 19:01, JoeM a écrit :
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.

I have the feeling that it does not do what I expect it does just by seeing the line. It is list comprehension, but the point is absolutely not in creating a list.

I'd say it breaks the rule «Explicit is better than implicit.» while «Special cases aren't special enough to break the rules.»

But well... could be a matter of taste; I prefer the loop.

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

Reply via email to