from spam import eggs, spam at runtime, how?

Peter Hansen peter at engcorp.com
Tue Dec 9 16:14:13 EST 2003


Paul Rubin wrote:
> 
> Rene Pijlman <reply.in.the.newsgroup at my.address.is.invalid> writes:
> > >Why not just stick the import statement where you need it?
> >
> > Because I need a module from one of a number of different packages, at one
> > specific point in my code.
> 
> I still don't understand why you don't want to use an exec statement
> for this.  That's by far the most natural and understandable way to do it.

In this case, he's getting the actual string from the web, so I wouldn't
be surprised if exec would be a real can of security worms.

-Peter




More information about the Python-list mailing list