I do have a map:
foo_map = {
'func1': sky()
'func2': tree()
'fnuc3': ground()
}
I do have a foobar_list = ['func2', 'fnuc3']
I do have methods too:
d
ef sky():
print "sky"
def tree():
print "tree"
def ground():
print "ground"
I do want to do as follows:
for element in foobar_list:
foo_map[element]
The expected result is to call methods assigned to 'func2'
, 'fnuc3'
so tree()
and ground()
without calling sky()
. Although, sky()
and ground()
and tree()
are called when foo variable is created because I understand memory is allocated for this variable object hence the calls are executed.
How to achieve the above without calling sky()
???
EDIT:
My question is not duplicate of the highlighted duplicated question. My question has been asked with different keywords and duplicate question has not been recommended as suggested answer when I typed my question. Technically, both questions are the same but the questions are not the same from natural language perspective.