vars(os) starts help in ActivePython!!!

Magnus Lyckå magnus at thinkware.se
Wed Feb 20 19:55:45 EST 2002


The problem is caused by the Helper in site.py:

import __builtin__

...

class Helper:
        def __repr__(self):
            import inspect
            if inspect.stack()[1][3] == '?':
                self()
                return ''
            return '<Helper instance>'
        def __call__(self, arg=None):
            import pydoc
            pydoc.help(arg)

__builtin__.help = Helper()

If I run this in cygwin, I get the same phenomena there.
Here's a snippet of output:

8<--
obals': <built-in function globals>, 'int': <built-in function int>, 'float': <b
uilt-in function float>, 'SyntaxError': <class exceptions.SyntaxError at 0xa0170
74>, 'pow': <built-in function pow>, 'vars': <built-in function vars>, 'help':
Welcome to Python 2.1!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.
8<--

"del __builtin__.help", or removing the above from site.py solves the 
problem, but removes the nice help facility... But changing 

__builtin__.help = Helper()

to

__builtin__.help = Helper

should make all systems go, except that I need to type "help()" to
reach the help menu. But maybe some fix in the Helper class could
sense the vars() problem. I'm too tired to figure that out now.



More information about the Python-list mailing list