Decorator Base Class: Needs improvement.
El Pitonero
pitonero at gmail.com
Wed Apr 6 12:28:26 EDT 2005
Bengt Richter wrote:
> On 5 Apr 2005 19:28:55 -0700, "El Pitonero" <pitonero at gmail.com>
wrote:
>
> >Scott David Daniels wrote:
> >> Ron_Adam wrote:
> >> > ...
> >>
> >> def tweakdoc(name):
> >> def decorator(function):
> >> function.__doc__ = 'Tweak(%s) %r' % (name, function.__doc__)
> >> return function
> >> return decorator
> >>
> >> What is confusing us about what you write is that you are
referring
> >to
> >> tweakdoc as a decorator, when it is a function returning a
decorator.
> >
> >"Decorator factory" would be a shorter name for "a function
returning a
> >decorator".
> >
> True, but tweakdoc doesn't have to be a function, so IMO we need a
better
> name for the @-line, unless you want to use many various specific
names
> like factory. E.g.,
There are two things:
(1) The "tweadoc" object in the example, which no doubt can be called a
decorator factory.
(2) The @-line, which you called a "decorator expression" and that's
fine with me. My preference would be something like the "decorator
header". A more clear statement would be something like: a "decorator
header expression" or the "expression in the decorator header", though
your proposed "decorator expression" would be clear enough, too.
I was addressing (1). You jumped in with (2), which I was aware of and
was not dissenting.
More information about the Python-list
mailing list