Hello again, I am disappointed. You are the experts, you've got to try harder ;-) What i want is a generalisation of this tiny function: import tokenize import token def magic_function(s): readline = open(s.gi_frame.f_code.co_filename).readline for t in tokenize.generate_tokens(open(s.gi_frame.f_code.co_filename).readline): t_type,t_string,(r_start,c_start),(r_end,c_end),line = t if r_start == s.gi_frame.f_code.co_firstlineno: if t_string=="magic_function": args= line.split(t_string) arg=args[1] return arg # returns its own argument ! print magic_function(i+2 for i in [1,2])
There ought to be a way to make it work for more than generator expressions !!! -- http://mail.python.org/mailman/listinfo/python-list