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


Groups > comp.lang.python > #110973

Re: Meta decorator with parameters, defined in explicit functions

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Meta decorator with parameters, defined in explicit functions
Date Sat, 2 Jul 2016 22:48:11 -0600
Lines 17
Message-ID <mailman.33.1467521333.2295.python-list@python.org> (permalink)
References <85mvm5vrbw.fsf@benfinney.id.au> <mailman.61.1467090177.2358.python-list@python.org> <21916e7b-9e19-4cef-94e0-bac331540ca2@googlegroups.com> <CALwzidn8DuSo-L2UQTJ7wZfzK+eHGzgGuy_ZfHFR9v4J_NHnjQ@mail.gmail.com> <mailman.15.1467436194.2295.python-list@python.org> <facf7142-25f5-4a8b-ab37-771884ab8d64@googlegroups.com> <CALwzid=GfLU8nbc5m4M9FxEO1ObWDTcvLJ3-wJXS0=w88-v8sw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 7wVITd1kMpRx7MXyB18BcQUT/pOC7dX10TaGmSvAwp+Q==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'that?': 0.05; '*args,': 0.07; 'func': 0.09; 'def': 0.13; 'applies': 0.15; '"""returns': 0.16; '2016': 0.16; 'posted:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:@ 20': 0.16; 'subject:parameters': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'decorator': 0.22; 'lawrence': 0.22; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; '**kwargs):': 0.29; 'received:google.com': 0.35; 'should': 0.36; 'instead': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'to:addr:python.org': 0.40; 'where': 0.40; 'subject:with': 0.40; 'skip:u 10': 0.61; 'saturday,': 0.63; 'jul': 0.72; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=qaympLUsSbTdmNPJfvYtt2KbFYHZu/zkYUp9/xN7s2c=; b=F0oQuKmPiuEBzteaZLDIR0JZWcSsMDio92qaLpwsNHyzC8eGnN5f3fby44LhATjiHz 1XmGbJznUEpDPhrTuFnamAA+BVS8hpkQkCSzyoi716yoqNEypc5po7VQX/ZDxOT4QzMG zc+cGM37f5lEYMZvZByqrPiX1QMi6u67PqmpBrl88EQ34vsWm0Q0vPVjMvxh6DjJxkh8 x2l//vGIUM1vM5NVOkKYhmmM3J6zQqTOEWiFJl+Cd7bCF6yS3RhYiGFpLDyDeFa4rHqM DtBVn6TqPWNQCA0YIBv3igohAceuF6IEE+IIksofRSrWsShRhDXOgp5VgQwKd/tKWVSC NppQ==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=qaympLUsSbTdmNPJfvYtt2KbFYHZu/zkYUp9/xN7s2c=; b=Z1fIjpyA//XvvtIJbsgDB/vKm+LLliU9tMk8WNMiTJhJ7OPk8IZCBHIPmeGNuAZgrp c0dF9CuCQqjkZZSo5AklYfj/YhUuvJAObOpsFddLEB0pRdz4BDgvB6z367VNVeSHyOtC MPb6wypzpK8i3WyyyqORDPVXtqWuSMcW/gmPqzZk88OFcmWJKpd3cEOJ1VAO8MMVixZA EEm3dnFz5TMhy2GLufZ6zlPnDJTd+3DWdPQgf5TyWcRDUbo4HX/gzc9DjXZEGZDm9oBg ODpuVeG4cSdzqrbW0w+fEuyIrh/iN1wCV74XkFB5Bk3wVRmuFLsVLTpV/f3P6400NSrA L0aw==
X-Gm-Message-State ALyK8tIN+rNbWz9GLZ0tcnF5mkHxpKDyplftUnN8Qqb4pPpDwPRqehieDO7ADwSBqsKS/TcQbLF3UYyuwIt5ug==
X-Received by 10.157.25.170 with SMTP id k39mr3951643otk.86.1467521330973; Sat, 02 Jul 2016 21:48:50 -0700 (PDT)
In-Reply-To <facf7142-25f5-4a8b-ab37-771884ab8d64@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CALwzid=GfLU8nbc5m4M9FxEO1ObWDTcvLJ3-wJXS0=w88-v8sw@mail.gmail.com>
X-Mailman-Original-References <85mvm5vrbw.fsf@benfinney.id.au> <mailman.61.1467090177.2358.python-list@python.org> <21916e7b-9e19-4cef-94e0-bac331540ca2@googlegroups.com> <CALwzidn8DuSo-L2UQTJ7wZfzK+eHGzgGuy_ZfHFR9v4J_NHnjQ@mail.gmail.com> <mailman.15.1467436194.2295.python-list@python.org> <facf7142-25f5-4a8b-ab37-771884ab8d64@googlegroups.com>
Xref csiph.com comp.lang.python:110973

Show key headers only | View raw


On Sat, Jul 2, 2016 at 12:40 AM, Lawrence D’Oliveiro
<lawrencedo99@gmail.com> wrote:
> On Saturday, July 2, 2016 at 5:10:06 PM UTC+12, Ian wrote:
>> You should use functools.wraps instead of clobbering the decorated
>> function's name and docstring:
>
> Where am I doing that?

Using the implementation you posted:

>>> @decorator_with_args
... def my_decorator(func, *args, **kwargs):
...     """Returns func unmodified."""
...     return func
...
>>> my_decorator.__doc__
'generates a decorator which applies my_decorator to the given arguments'

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


Thread

Meta decorator with parameters, defined in explicit functions Ben Finney <ben+python@benfinney.id.au> - 2016-06-28 15:02 +1000
  Re: Meta decorator with parameters, defined in explicit functions Paul Rubin <no.email@nospam.invalid> - 2016-06-27 23:08 -0700
  Re: Meta decorator with parameters, defined in explicit functions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-28 18:39 +1000
  Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-29 19:43 -0700
    Re: Meta decorator with parameters, defined in explicit functions Steven D'Aprano <steve@pearwood.info> - 2016-06-30 13:49 +1000
    Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Peter Otten <__peter__@web.de> - 2016-06-30 09:25 +0200
      Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-30 00:43 -0700
        Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-06-30 18:00 +1000
        Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Peter Otten <__peter__@web.de> - 2016-06-30 10:41 +0200
    Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions dieter <dieter@handshake.de> - 2016-07-01 09:04 +0200
      Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-01 21:25 +0100
        Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Ben Finney <ben+python@benfinney.id.au> - 2016-07-02 11:52 +1000
        Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions dieter <dieter@handshake.de> - 2016-07-02 08:57 +0200
        Re: Fear and suspicion of lambdas, was Re: Meta decorator with parameters, defined in explicit functions Ben Finney <ben+python@benfinney.id.au> - 2016-07-02 18:00 +1000
  Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-29 19:50 -0700
  Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-01 15:08 -0700
    Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-01 23:09 -0600
      Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-01 23:40 -0700
        Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-02 22:48 -0600
          Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-02 22:37 -0700
            Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-03 05:52 -0600
              Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-03 14:17 -0700
                Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-03 16:38 -0600
                Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-03 16:25 -0700
                Re: Meta decorator with parameters, defined in explicit functions Chris Angelico <rosuav@gmail.com> - 2016-07-04 09:39 +1000
                Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-03 16:59 -0700
                Re: Meta decorator with parameters, defined in explicit functions Chris Angelico <rosuav@gmail.com> - 2016-07-04 10:06 +1000
                Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-03 17:23 -0700
                Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-03 18:01 -0600
                Re: Meta decorator with parameters, defined in explicit functions Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-03 17:06 -0700
                Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-03 18:20 -0600
    Re: Meta decorator with parameters, defined in explicit functions Ben Finney <ben+python@benfinney.id.au> - 2016-07-02 15:32 +1000
    Re: Meta decorator with parameters, defined in explicit functions Ian Kelly <ian.g.kelly@gmail.com> - 2016-07-01 23:53 -0600

csiph-web