Getting the keyword arguments actually passed to a Python method

前端 未结 8 660
挽巷
挽巷 2020-12-24 03:45

I\'m dreaming of a Python method with explicit keyword args:

def func(a=None, b=None, c=None):
    for arg, val in magic_arg_dict.items():   # Where do I get         


        
8条回答
  •  醉梦人生
    2020-12-24 04:11

    Magic is not the answer:

    def funky(a=None, b=None, c=None):
        for name, value in [('a', a), ('b', b), ('c', c)]:
            print name, value
    

提交回复
热议问题