Original Post
The variable in Python co_varnames is a tuple of variables from the function. Does anyone know if the tuple is in ORDER. Example: I've looked and found nothing stating it is or not in ORDER (I'm thinking and hoping that it is in ORDER). That way I can use the order of co_varnames for pulling the right keys out of the vars hash. L-
LIST='list'
def list_length(result=LIST, lst=LIST, newlst=LIST, body="""
(cond ((null lst)
(t)
(+1 my)""" ):
"""'My version of the length function for lists'"""
random_var="not really useful"
return locals()
>>> import MyMod
>>> MyMod.list_length.func_code.co_varnames
('result', 'lst', 'newlst', 'body', 'random_var')
//~------------------------------------------------------
// However the hash return is, or course, not in order:
>>> vars = MyMod.list_length()
>>> vars
{'body': '\n (cond ((null lst)\n (t)\n (+1 my)', 'rando
m_var': 'not really useful', 'lst': 'list', 'newlst': 'list', 'result': 'list'}