Is this possible in Python?

alainpoint at alainpoint at
Mon Mar 13 21:41:07 CET 2006

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
		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)
				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 !!!

More information about the Python-list mailing list