On Wed, 25 Jul 2007 15:46:58 +0000, beginner wrote:

> I know the * operator. However, a 'partial unpack' does not seem to
> work.
> 
> def g():
>   return (1,2)
> 
> def f(a,b,c):
>   return a+b+c
> 
> f(*g(),10) will return an error.


No it doesn't, it _raises_ an exception. This is a function that returns
an error:

def function():
    """Returns an error."""
    return Error()  # defined elsewhere

But to answer your question:

> Do you know how to get that to work?

It's a little bit messy, but this works:

>>> f(*(g() + (10,)))
13

This is probably easier to read:

>>> t = g() + (10,); f(*t)
13


-- 
Steven.

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

Reply via email to