Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: What is wrong this wrapper (decorator)? Date: Mon, 16 Nov 2015 19:30:54 +1300 Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net UvkGRmydngj4kpE/bdQ5aAaCXpPNE0yytRUio3JFfhko3+PTUb Cancel-Lock: sha1:2TV+dic010VoNQXC4k+eMrMuYGc= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:98868 fl wrote: > wrapper(sub(two, one)) > Out[38]: This doesn't do what you probably meant it to do. It first calls sub() with arguments one and two, and then passes the result of that (a Coordinate, if sub is working properly) to wrapper(). Since wrapper() expects a function, not a Coordinate, that won't do anything useful. What you probably meant to do is: wrapper(sub)(one, two) This passes the function sub to wrapper, which returns another function; that function is then called with arguments one and two. -- Greg