Python syntax in Lisp and Scheme

Dave Benjamin ramen at lackingtalent.com
Fri Oct 17 15:12:29 EDT 2003


In article <mailman.181.1066417144.2192.python-list at python.org>, David Mertz wrote:
>
> I know I'm in the minority here, but it feels like more of a hack to me
> to make class instances whose (main) purpose is to "act like functions"
> (i.e. have custom '.__call__()' methods).  In my mind, when I want a
> bunch of related callables, the natural approach is writing a function
> factory, not a class.

In most cases, I would completely agree with you. Though they are often
interchangeable (closures and callable objects), there is a subtle semantic
difference to me. Is it a stateful function or a callable object? What does
it feel like? I usually go with my intuition.

-- 
.:[ dave benjamin (ramenboy) -:- www.ramenfest.com -:- www.3dex.com ]:.
: d r i n k i n g   l i f e   o u t   o f   t h e   c o n t a i n e r :




More information about the Python-list mailing list