Is this possible in Python?

alainpoint at yahoo.fr alainpoint at yahoo.fr
Mon Mar 13 22:18:26 CET 2006


Hi Kent,
My intention is to be able to retrieve any line of code in a running
program, in the following way:
def magic_funct(s):
	for line in file(s.gi_frame.f_code.co_filename):
		print line
magic_funct(i for i in [1,2,3])

I just find it stupid to be obliged to use a generator expression, just
because it has got the gi_frame attribute. Such a kind of introspection
can be very useful.
I don't want a better way, i just want a solution to the problem as
described!

Alain




More information about the Python-list mailing list