[Python-Dev] Re: String module

François Pinard pinard@iro.umontreal.ca
31 May 2002 14:22:34 -0400

>     >> By the way, I wonder why the `_' in `sys._getframe()'.

>     >> To discourage people from using it.

> Because [the previous way] is slow, hard to remember, and too magical.

That is, in short, discouraging, exactly as per the wish of Guido! :-)

A bit more seriously, it is fun writing:

        frame = sys._getframe(1)
    except AttributeError:
        frame = sys.exc_info()[2].tb_frame.f_back

putting the error to good use whenever `_getframe' is not available!

François Pinard   http://www.iro.umontreal.ca/~pinard