[Python-Dev] locals(), closures, and IronPython...

Mike Klaas mike.klaas at gmail.com
Wed Mar 7 00:23:11 CET 2007


On 3/6/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Although you can get a similar effect now by doing
>
>       def __init__(self, **kwds):
>          args = dict(prec=None, rounding=None,
>                    traps=None, flags=None,
>                    _rounding_decision=None,
>                    Emin=None, Emax=None,
>                    capitals=None, _clamp=0,
>                    _ignored_flags=None)
>          args.update(kwds)
>          for name, value in args:
>             ...
>
> So, no need for locals() here.

Yes, that is the obvious approach.  But it is painful to abandon the
introspectable signature.

There's nothing quite like running help(func) and getting *args,
**kwargs as the documented parameter list.

-Mike


More information about the Python-Dev mailing list