I was thinking you could do something strange like: kw = {object(): None} def test(**kw): print kw test(**kw)
however, upon testing it (in Python 2.6), I found that it errors while trying to unpack the kw dict stating that they must all be strings. Perhaps making a custom class derived off basestring, str, unicode, or bytes might allow some oddness and possibly slightly worse performance. Chris On Tue, May 31, 2011 at 10:10 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > On Tue, May 31, 2011 at 10:34 AM, Chris Kaynor <ckay...@zindagigames.com> > wrote: > > Is there any reason not to simplify this to: > > def copy_args(f): > > @functools.wraps(f) > > def wrapper(*args, **kw): > > nargs = copy.deepcopy(args) > > nkw = copy.deepcopy(kw) > > return f(*nargs, **nkw) > > return wrapper > > No reason, good call. > > > It means you will copy the keys as well, however they will (almost) > > certainly be strings which is effectively a no-op. > > I think the keys will certainly be strings. Is there any scenario > where they might not be? > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list