Init a table of functions

Richard Blackwood richardblackwood at cloudthunder.com
Sat Oct 9 23:12:27 EDT 2004


<SNIP>

>>
>>
>> Move the table outside of the class definition
>>
>> class foo(object):
>>     def f1():
>>         print 'f1'
>>     f1 = staticmethod(f1)
>>
>> foo.K = {'f1': foo.f1,
>>         }
>>
>> foo.K['f1']()
>>
> Right Right Right.
> Notice how he added the "object" as an arg to class foo.

Now that I think of it some more, why did you add that object arg?  
That's not necessary.



More information about the Python-list mailing list