pythonic way of 'b = list(a); b.append(4)"

szabi szabolcs.berecz at gmail.com
Thu Feb 16 14:29:46 EST 2006


The question was perfectly answered by Heiko Wundram:
f(*(a+[4]))

I know python is not a lawnmower but a programming language. I can
solve a lot of problems, but I prefer short, clear and nice solutions
to long and/or too powerful ones. So, my problem with my solution (b =
list(a); b.append(4)) was the same as with the others' involving
functions.

Actually what I missed is the fact that the + operator works fine with
lists...
With '+' I can solve everything. Ok, _almost_ everything :)

Thanks for everybody!

Szabi




More information about the Python-list mailing list