A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-October/010093.html below:

[Python-Dev] getting at the current frame

[Python-Dev] getting at the current frame [Python-Dev] getting at the current frameM.-A. Lemburg mal@lemburg.com
Tue, 24 Oct 2000 22:45:28 +0200
"Barry A. Warsaw" wrote:
> [...]
> All well and good and doable in Python today, except getting the
> current frame with the exception raising trick is slooow.  A simple
> proposed addition to the sys module can improve the performance by
> about 8x:
> 
>     def _(s):
>         frame = sys.getcaller(1)
>         d = frame.f_globals.copy()
>         d.update(frame.f_locals())
>         return the_translation_of(s) % d
> 
> The implementation of sys.getcaller() is given in the below patch.
> Comments?  I think this particular addition is too small for a PEP,
> although ?!ng still owns PEP 215 (which needs filling in).

+1. 

I have a similar function in mxTools. I would use a different
name though... something like "sys.getframe()".

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4