A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-August/047943.html below:

[Python-Dev] Decorator order implemented backwards?

[Python-Dev] Decorator order implemented backwards? [Python-Dev] Decorator order implemented backwards?Michael Chermside mcherm at mcherm.com
Tue Aug 17 18:40:02 CEST 2004
Mark writes:
> Your patch results in the evaluation order:
>
>     evalname1 evalargs1 makedec1
>     evalname2 evalargs2 makedec2
>     evalname3 evalargs3 makedec3
>     calldec3 calldec2 calldec1
>
> Mine (#1009560) gives:
>
>     evalname3 evalargs3 makedec3 calldec3
>     evalname2 evalargs2 makedec2 calldec2
>     evalname1 evalargs1 makedec1 calldec1

Guido writes:
> Since Mark ended up agreeing with your order, the OK is given by
> default. :-)

Wait... I'm confused. What was the final decision? I favor

     evalname1 evalargs1 makedec1
     evalname2 evalargs2 makedec2
     evalname3 evalargs3 makedec3
     calldec3 calldec2 calldec1

becase of left-to-right-top-to-bottom evaluation. Is this what it
actually does? I imagine this:

      >>> # Warning - not actual code
      >>> def dummyDecorator1(x):
      ...     print 'one'
      ...     return x
      ...
      >>> def dummyDecorator2(x):
      ...     print 'two'
      ...     return x
      ...
      >>> @dummyDecorator1
      >>> @dummyDecorator2
      >>> def func(): pass
      two
      one

which somehow seems wrong to me.

-- Michael Chermside

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4