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/

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to