Needed to make one change... for functions with no default args:

def pdict(f):
    parameter_defaults = {}
    defaults = f.func_defaults
    if defaults is not None:
        defaultcount = len(defaults)
    else:
        defaultcount = 0
    argcount = f.func_code.co_argcount
    for i in xrange(f.func_code.co_argcount):
        name = f.func_code.co_varnames[i]
        value = None
        if i >= argcount - defaultcount:
            value = defaults[i - (argcount - defaultcount)]
        parameter_defaults[name] = value
    return parameter_defaults

                                          
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to