default value in a list

Alex Martelli aleaxit at
Sat Jan 22 06:30:36 EST 2005

Nick Craig-Wood <nick at> wrote:
> Or this version if you want something other than "" as the default
>   a, b, b = (line.split(':') + 3*[None])[:3]

Either you mean a, b, c -- or you're being subtler than I'm grasping.

> BTW This is a feature I miss from perl...

Hmmm, I understand missing the ``and all the rest goes here'' feature
(I'd really love it if the rejected
    a, b, *c = whatever
suggestion had gone through, ah well), but I'm not sure what exactly
you'd like to borrow instead -- blissfully by now I've forgotten a lot
of the perl I used to know... care to clarify?


More information about the Python-list mailing list