[IronPython] getframe and __file__

orip oripel at gmail.com
Mon Nov 17 08:53:02 CET 2008


That certainly fits my use case.
It would be cool to check for an "IronPython Extensions" module and
use it if available.

On Nov 16, 7:39 pm, Michael Foord <fuzzy... at voidspace.org.uk> wrote:
> 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
> Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list