17 Apr
2001
17 Apr
'01
3:20 p.m.
Why the strange check involving inspect.stack()? inspect.stack()[1][3] is the co_name of the parent frame. If we check that the __repr__ is not being requested by a function call, everything works perfectly in IDLE as well as the plain interpreter, and the helper object is still safe to pass around. Nothing breaks even if you say help(help).
This is one of the reasons why I didn't want to add this to the 2.1 release at such a late point. I have no easy way to verify that this is always true, and in fact I have no idea what inspect.stack()[1][3] means. :-( I just add "from pydoc import help" to my $PYTHONSTARTUP file. --Guido van Rossum (home page: http://www.python.org/~guido/)