Automatic import PEP

Dan Bishop danb_83 at yahoo.com
Fri Oct 6 18:18:53 CEST 2006


On Sep 22, 10:09 pm, Connelly Barnes <connellybar... at yahoo.com> wrote:
> Hi,
>
> I wrote the 'autoimp' module [1], which allows you to import lazy modules:
>
> from autoimp import *     (Import lazy wrapper objects around all modules; "lazy
>                            modules" will turn into normal modules when an attribute
>                            is first accessed with getattr()).
> from autoimp import A, B  (Import specific lazy module wrapper objects).
>
> The main point of autoimp is to make usage of the interactive Python prompt
> more productive by including "from autoimp import *" in the PYTHONSTARTUP file.

And it does.  Gets rid of "oops, I forgot to import that module"
moments without cluttering my $PYTHONSTARTUP file with imports.  +1.

My only complaint is that it breaks globals().




More information about the Python-list mailing list