Function that knows the names of its actual parameters

Aahz Maruch aahz at netcom.com
Sun Jun 18 17:53:57 EDT 2000


In article <394a6395.7217524 at news.btx.dtag.de>,
Stefan Franke <spamfranke at bigfoot.de> wrote:
>
>I found myself in need for the following functionality a couple of times:
>
>>>> a=1
>>>> b="foo"
>>>> c=b
>>>> magic(c, b, a)
>{'a': 1, 'b': 'foo', 'c': 'foo'}
>
>that is, a function that goes one step further than **dict arguments
>and returns a dictionary with names and values of its actual
>parameters.  It's useful every time one tries to write generators for
>Python or other code (right now I'm writing some SQL code emitting
>functions).

Why not simply write a function that takes a dict as its parameter?
Maybe if you gave a better description of an occasion you think you need
this feature we could give you a better answer.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"The only problem with Microsoft is they just have no taste." --Steve Jobs
(From _Triumph of the Nerds_ PBS special)



More information about the Python-list mailing list