h(re) for help, import re - on NameError
Chris Angelico
rosuav at gmail.com
Fri Sep 23 03:01:12 EDT 2016
On Fri, Sep 23, 2016 at 4:40 PM, Peter Otten <__peter__ at web.de> wrote:
> By the way, the current help() already loads a module if you pass its name
> as a string:
>
Yes, which is the basis of my alternate exec trick:
exec(tb.tb_frame.f_code, tb.tb_frame.f_globals, {n: n})
Basically it creates a new locals dict that just has (eg) re="re",
which allows help(re) to function as help("re").
ChrisA
More information about the Python-list
mailing list