About 203,000 results
Open links in new tab
  1. python - Using a dictionary to select function to execute - Stack …

    4 This will call methods from dictionary This is python switch statement with function calling Create few modules as per the your requirement. If want to pass arguments then pass. Create …

  2. python - Passing a dictionary to a function as keyword parameters ...

    How to use a dictionary with more keys than function arguments: A solution to #3, above, is to accept (and ignore) additional kwargs in your function (note, by convention _ is a variable …

  3. python - Is there a way to store a function in a list or dictionary so ...

    159 Functions are first class objects in Python and so you can dispatch using a dictionary. For example, if foo and bar are functions, and dispatcher is a dictionary like so.

  4. How to pass dictionary items as function arguments in python?

    How to pass dictionary items as function arguments in python? [duplicate] Asked 11 years, 9 months ago Modified 5 years, 9 months ago Viewed 322k times

  5. Mapping over values in a python dictionary - Stack Overflow

    Sep 1, 2012 · The plus point is that this dictionary can be used to store the original data as if it was a dict, while transforming any data on request with a callback. Of course, feel free to …

  6. python - Applying a function to values in dict - Stack Overflow

    Oct 25, 2012 · Dictionaries can be nested in Python and in this case the solution d2 = {k: f(v) for k, v in d1.items()} will not work. For nested dictionaries one needs some function to transverse …

  7. python - Storing lambdas in a dictionary - Stack Overflow

    I have been trying to create a dictionary with a string for each key and a lambda function for each value. I am not sure where I am going wrong but I suspect it is either my attempt to store a …

  8. Calling functions with parameters using a dictionary in Python

    9 Sure. In Python, functions can take positional or keyword arguments. For most functions, arguments can be passed in either way, but that’s not necessarily the case for all functions, so …

  9. dictionary - lambda in python can iterate dict? - Stack Overflow

    Oct 12, 2015 · You don't iterate with lambda. There are following ways to iterate an iterable object in Python: for statement (your answer) Comprehension, including list [x for x in y], dictionary …

  10. python dictionary passed as an input to a function acts like a …

    To support what @Casey Kuball said, every object in Python is passed by reference. Each function receives a reference to the actual object you passed. Modifying these objects …