Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98868
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: What is wrong this wrapper (decorator)? |
| Date | 2015-11-16 19:30 +1300 |
| Message-ID | <datbh0F80u3U1@mid.individual.net> (permalink) |
| References | <dafb679e-c94c-47d2-9209-ce2a86a673d6@googlegroups.com> |
fl wrote: > wrapper(sub(two, one)) > Out[38]: <function checker> 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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
What is wrong this wrapper (decorator)? fl <rxjwg98@gmail.com> - 2015-11-14 09:23 -0800 Re: What is wrong this wrapper (decorator)? fl <rxjwg98@gmail.com> - 2015-11-14 09:29 -0800 Re: What is wrong this wrapper (decorator)? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-11-16 19:30 +1300
csiph-web