On 07/02/2011 01:08 PM, John Salerno wrote:
On Jul 2, 12:33 pm, MRAB<pyt...@mrabarnett.plus.com> wrote:
roll_die = move(roll_die)
You should be defining a function (a callable) and then passing it to a
decorator which returns a callable.
But why does the documentation say "The return value of the decorator
need not be callable"?
I must not be looking at the same documentation you are...could
you provide a link? The only time I know of that the return value
of a decorator need not be callable is if you want to totally
break the syntax of the function. :-/
And why, if I remove the decorator and just leave the two
functions as if, does the call to move(roll_die()) work? Isn't
that what the decorator syntax is essentially doing?
Are you doing
move(roll_die()) #call roll_die() and pass results to move()
or
move(roll_die) # pass the function-object roll_die to move()
? The decorator syntax is the equivalent of
roll_die = move(roll_die)
-tkc
--
http://mail.python.org/mailman/listinfo/python-list