>>>>> "GvR" == Guido van Rossum <guido@python.org> writes: GvR> The other, perhaps more major, problem with this it is that GvR> you can't easily wrap functions that use it in other GvR> functions. Normally, if there's a function foo(arg) that GvR> does something, I can write a function wrapfoo(arg) that does GvR> something else, then calls foo(arg), and then does another GvR> thing. But if foo() uses getframe(), that's not so easy: the GvR> call to foo() in wrapfoo() will access wrapfoo()'s frame. GvR> A way around this would be to implement foo as a call to GvR> (e.g.) _foo(arg, frame), and define foo(arg) as _foo(arg, GvR> sys.getframe()). Then _wrapfoo(arg, frame) could be defined GvR> as a wrapper around _foo(arg, frame) and wrapfoo(arg) as GvR> _wrapfoo(arg, sys.getframe()). Darn good point. So where could we put it? It's a useful introspection device. If it goes in a separate module, should that perhaps be called `reflection'? Or maybe `runtime'? Or maybe "sys._getframe()" is good enough. -Barry
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