[Python-Dev] Re: String module

Guido van Rossum guido@python.org
Fri, 31 May 2002 10:03:44 -0400


> By the way, I wonder why the `_' in `sys._getframe()'.  Was it to
> mark that this is a function giving access to internals?  If yes,
> this only increases my wondering, since there are other functions in
> `sys' which give access to internals, and which do not use such a
> `_' prefix.  I presume this has been debated in the proper time, I
> was probably elsewhere and missed the discussion.  Could the reason
> be summarised in one sentence? :-)

To discourage people from using it.  This function enables a
programming idiom where a function digs in its caller's namespace.  I
find that highly undesirable so I wanted to emphasize that this
function does not exist for that purpose.  (Neither does
inspect.currentframe(). :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)