[Python-ideas] __decorate__ method

Brett Cannon brett at python.org
Tue Apr 20 21:46:43 CEST 2010


On Tue, Apr 20, 2010 at 07:13, Jim Jewett <jimjjewett at gmail.com> wrote:

> On 20 April 2010 03:37, Zac Burns <zac256 at gmail.com> wrote:
>
> > Guido does say that __decorate__ should not replace __call__
>
> > (Sidenote: Can someone explain what the backward incompatibility is?)
>
> Note that this only means it shouldn't *replace* __call__.  Using
> __decorate__ if it exists and falling  back to __call__ would be
> acceptable from a backwards compatibility standpoint.  (It may be
> ruled out for ugliness or complication, but not for backwards
> compatibility.)


Jim's right on the backwards-compatibility point.

But I say YAGNI on this. If this Null class needs a no-op decorator either
introspect on the parameters to __call__ to do what is needed, use your own
custom decorate() function that take in the decorator to use and introspects
for Null, or something along those lines. There is no common class of
problem that __decorate__ would solve.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100420/69f4faef/attachment.html>


More information about the Python-ideas mailing list