[Tutor] Function in a data structure
Tim Johnson
tim@johnsons-web.com
Mon Jun 23 20:16:01 2003
Hello All:
I'd like to put a function in data structure
and execute it as part of processing the
structure.
I have
>>fd = {'func':[lambda x: x**2]}
How may I execute the lambda statement which
is the value for fd['func']?
I've tried:
apply(fd['func'],(2))
and apply(fd['func'],2)
with no luck
Any ideas? Pointers to docs will
be most welcome also.
using Python 2.2.2
TIA
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com