h(re) for help, import re - on NameError

Peter Otten __peter__ at web.de
Fri Sep 23 02:40:07 EDT 2016


Veek M wrote:

> Is there a way to use .pythonrc.py to provide a help function that
> autoloads whatever module name is passed like so:

By the way, the current help() already loads a module if you pass its name 
as a string:

$ echo 'print("importing foo")' >  foo.py
$ python3
Python 3.4.3 (default, Sep 14 2016, 12:36:27) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help("foo")
importing foo
Help on module foo:

NAME
    foo

[snip]





More information about the Python-list mailing list