[Python-ideas] return value of yield expressions

Nick Coghlan ncoghlan at gmail.com
Wed Sep 14 05:41:54 CEST 2011


On Wed, Sep 14, 2011 at 3:23 AM, Ron Adam <ron3200 at gmail.com> wrote:
> If we could get the functions arguments when a function is done instead
> of getting the return value.  (The modified function arguments object is
> the return value in this case.)
>
>      fargs = &foo(a, b, c, d=4)

This use case is covered by the bind() method in PEP 362 [1]:

    foo_signature = inspect.signature(foo)
    fargs = foo_signature.bind(a, b, c, d=4)

[1] http://www.python.org/dev/peps/pep-0362/#signature-object

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list