As near as I can tell, a functor is just an object which is
callable like a function
I believe that's how they're defined in the C++ world, in which, of
course, functions aren't first-class objects...
-------------
Rami Chowdhury
"Never assume malice when stupidity will suffice." -- Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)
On Aug 19, 2009, at 21:11 , Steven D'Aprano wrote:
On Wed, 19 Aug 2009 18:42:32 -0700, Paul Rubin wrote:
Robert Dailey <rcdai...@gmail.com> writes:
I want to simply wrap a function up into an object so it can be
called
with no parameters.
Nitpick: what you are asking for is called a closure. "Functor"
means
something completely different.
I'm glad somebody else noticed this. I would have said something
about it
myself, except I wasn't entirely sure my understanding of functor is
correct. As near as I can tell, a functor is just an object which is
callable like a function without actually being implemented as a
function, e.g.:
class Functor:
def __call__(self):
return None
f = Functor()
result = f()
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list