Using multiple "*"-style arguments

Andrew Koenig ark at
Fri Jun 18 16:33:06 CEST 2004

"Dave Opstad" <dave.opstad at> wrote in message
news:dave.opstad-D50FCC.07252818062004 at

> File this one under "enhancement request" I guess, but it would sure be
> nice. I wrote this line the other day, thinking it would just work:
> x = struct.pack(">HhhhhhhHHHL", i, *bounds, *b[0:2], *b[6:9], len(s))
> Unfortunately, it doesn't. The only valid place for an "*"-style
> argument is at the end of the arguments list. But this line seems so
> natural! Since struct.pack expects all its arguments separately (rather
> than gathered into a list or tuple), I have to be able to accommodate
> its needs, and since I had several arguments already in lists, I thought
> I could get away with this notation.

Does this do what you want?

    x = struct.pack((">HhhhhhhHHHL", i, *(bounds + b[0:2] + b[6:9] +

More information about the Python-list mailing list