Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively.

This commit is contained in:
Ka-Ping Yee 2001-04-13 13:57:31 +00:00
parent eca15c1fb1
commit 9bc576b7f6
1 changed files with 2 additions and 2 deletions

View File

@ -1268,10 +1268,10 @@ class Helper:
self.docdir = dir self.docdir = dir
def __repr__(self): def __repr__(self):
if len(inspect.stack()) <= 2: if inspect.stack()[1][3] == '?':
self() self()
return '' return ''
return '<pydoc.Helper instance at %p>' % id(self) return '<pydoc.Helper instance>'
def __call__(self, request=None): def __call__(self, request=None):
if request is not None: if request is not None: