Re: What is wrong this wrapper (decorator)?

2015-11-15 Thread Gregory Ewing
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

What is wrong this wrapper (decorator)?

2015-11-14 Thread fl
Hi, I follow a tutorial to learn decorator: http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/ I use Enthought Canopy to run the following code. It is really strange that the wrapper does not take effect. In fact, I go back to the basic way (not with @): wrapper(sub(two,

Re: What is wrong this wrapper (decorator)?

2015-11-14 Thread fl
On Saturday, November 14, 2015 at 12:23:50 PM UTC-5, fl wrote: > Hi, > > I follow a tutorial to learn decorator: > > http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/ > > I use Enthought Canopy to run the following code. > It is really strange that the wrapper does not