About 50 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. 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 …

  3. 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 …

  4. 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 …

  5. python - Calling a function from within a dictionary - Stack Overflow

    From what I understand, what you actually mean is how to keep the function reference inside a dictionary to be able to call it later after getting it from the dictionary by key. This is possible …

  6. 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 …

  7. 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.

  8. 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 …

  9. python - What does ** (double star/asterisk) and * (star/asterisk) …

    Aug 31, 2008 · 220 What does (double star) and (star) do for parameters? They allow for functions to be defined to accept and for users to pass any number of arguments, positional (*) …

  10. Calling python dictionary of function from class - Stack Overflow

    I'm relatively new to python and would like to make a class that has a dictionary that corresponds to different methods in the class. I currently have : class Test: functions = {"Test1":test1, "...