Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6744

Re: scope of function parameters (take two)

References (2 earlier) <BANLkTin5exEpDkE3on3BAaWwHOjpg_vC8g@mail.gmail.com> <6699AB10-988A-49AD-B7C1-6BAA2CC3D008@mcgill.ca> <BANLkTikH0S4TNAjZzfAj6mAQoTeXLYFpgQ@mail.gmail.com> <BANLkTikVniZv-wP2pQhVs7BrsBeesFudgQ@mail.gmail.com> <BANLkTim65+8Cd3WidNNrxr22vWw65qQ+Qg@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-05-31 11:10 -0600
Subject Re: scope of function parameters (take two)
Newsgroups comp.lang.python
Message-ID <mailman.2324.1306861890.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, May 31, 2011 at 10:34 AM, Chris Kaynor <ckaynor@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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: scope of function parameters (take two) Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-31 11:10 -0600

csiph-web