Le dimanche 13 août 2006 14:18, John Machin a écrit : > I don't usually go for one-liners, especially ugly ones like > "inspect.stack()[1][1:3]" but it avoids the risk of hanging on to a > reference to the frame object -- see the warning in the inspect docs.
Yes, my mistake, thanks for pointing this out, my suggestion should have been more accurate : import inspect try : c=inspect.currentframe() log_msg(c.f_lineno, c.f_code.co_filename) finally : del c or shorter ; from inspect import currentframe log_msg(currentframe().f_lineno, currentframe().f_code.co_filename) -- _____________ Maric Michaud _____________ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 426 880 097 -- http://mail.python.org/mailman/listinfo/python-list