Another form of dynamic import

Anton Hartl anton.hartl+news at gmail.com
Wed Mar 25 15:31:56 EDT 2009


On 2009-03-25, Marco Nawijn <nawijn at gmail.com> wrote:
> Hello,
>
> In short I would like to know if somebody knows if it is possible to
> re-execute a statement that raised an exception? I will explain the
> reason by providing a small introduction on why this might be nice in
> my case
> and some example code.
>
> I am using the python bindings to a *very* large C++ library. About
> 5000 classes divided over approx. 450 different
> packages are exposed through the Python interface. To reduce the
> number of import statements that need to be inserted and to limit the
> number of wildcard imports it would be very helpful if class names
> could be automatically imported from the proper module. There is no
> problem in finding out the proper module given a (valid) class name.

Maybe this helps:

    http://www.connellybarnes.com/code/autoimp/

Regards,
    Anton



More information about the Python-list mailing list