[IronPython] getframe and __file__
Michael Foord
fuzzyman at voidspace.org.uk
Sun Nov 16 18:39:30 CET 2008
Hello guys,
Around 90% of the uses for sys._getframe that I've seen are to find out
the calling module, by accessing __file__ in the calling frame globals.
I just wondered if it would be any cheaper to just track this
information and fake out the frame objects so that this use case is met?
The answer is probably no as it basically requires tracking the same
information (and I guess that the performance hit comes mainly from the
thread locals and frame tracking rather than from building the Python
stack frame objects) - but on the off-chance that it might be cheaper
(obviously only the tracking needs to be implemented - everything else
can be built on demand) I thought I would throw it out there.
Michael
--
http://www.ironpythoninaction.com/
More information about the Ironpython-users
mailing list