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/047280.html below:

[Python-Dev] Re: Decorators with arguments are curries!

[Python-Dev] Re: Decorators with arguments are curries!Guido van Rossum guido at python.org
Sat Aug 7 18:29:44 CEST 2004
> The primary issues were: (1) That decorators with vs. without
> arguments look inconsistent, like function calls vs. function
> references, and (2) that consequentially, decorator syntax is
> implicitly introducing a non-viable currying syntax.

I think you're mistaken.  When using @foo, foo should be a function
taking one argument; when using @foo(x,y,z), the *call* to foo(x,y,z)
should return a function of one argument (or an equivalent callable
object, of course).  This is often done by defining an inner "helper"
function, e.g.:

    def funcattrs(**kwds):
	def helper(func):
	    func.__dict__.update(kwds)
	return helper

    @funcattr(counter=42, obsolete=True)
    def foobar():
	pass

--Guido van Rossum (home page: http://www.python.org/~guido/)

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