Do I have to formally define a function before I can use it as an element of a dictionary?
def my_func(): print 'my_func' d = { 'function': my_func }
I would rather define the function inline. I just tried to type out what I want to do, but the whitespace policies of python syntax make it very hard to define an inline func within a dict. Is there any way to do this?
Advertisement
Answer
The answer seems to be that there is no way to declare a function inline a dictionary definition in python. Thanks to everyone who took the time to contribute.