Created
August 13, 2014 14:03
-
-
Save ericdill/7f21da1b5950b6096630 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo(var1=None, var2=False, var3=None, var4=None): | |
# get the number of input arguments | |
argcount = foo.func_code.co_argcount | |
# get the names of those input arguments | |
varnames = search.func_code.co_varnames[:argcount] | |
# get the values of those input arguments | |
# ??? | |
# I can programatically do it by: | |
varvals = [var1, var2, var3, var4] | |
# and then create a dictionary by: | |
var_dict = {} | |
for name, val in zip(varnames, varvals): | |
var_dict[name] = val | |
# but do I have to know the names of the input parameters to create | |
# the list on line 9? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment