Python becoming less Lisp-like

Steven Bethard steven.bethard at gmail.com
Tue Mar 15 18:51:29 EST 2005


Bruno Desthuilliers wrote:
>> class CommandMenuSelectionCallback:
>>     def __init__(self, key):
>>         self.key = key
>>
>>     def __call__(self):
>>         print self.key
> 
> 
> Looks like Java.

When was the last time you used Java?  It has no support for using 
classes as callable objects.  __call__ would have to be invoked 
manually; you definitely couldn't have a CommandMenuSelectionCallback 
instance masquerading as a function as this code (basically) does.

STeVe



More information about the Python-list mailing list