Apr-25-2019, 11:05 PM
it has been said not to define functions by assigning a lambda. but i want to have a dictionary (or list as the use case may be) contain a bunch of functions (perhaps small ones). i see no easy way to do this with def:
yeah, i know you can do a def then assign that name to the dictionary item. but that just looks so ugly:
def function_collection['foobah'](a): # invalid syntax return a*a+athe only clean way looks like:
function_collection['foobah'] = lambda a:a*a+ais this an OK exception?
yeah, i know you can do a def then assign that name to the dictionary item. but that just looks so ugly:
def foobah(a): return a*a+a function_collection['foobah'] = foobah
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.