reload() gone?

Chris Mellon arkanes at
Fri Aug 31 23:25:00 CEST 2007

On 8/31/07, Arnaud Delobelle <arnodel at> wrote:
> On Aug 31, 7:10 pm, "Bernard Lebel" <3dbern... at> wrote:
> > I read in the Python 3.0 documentation that reload() was removed,
> > without further explanations.
> >
> >
> >
> > So what are we supposed to do to reload modules?
> >
> PEP 3100 says: use exec() instead.

However, it provides no information on how to do this. exec("import
foo") doesn't do it. exec(open(foo.__file__)) doesn't work either, but
that might just be teething problems (open returns a TextIOWrapper
object which exec doesn't identify as a file).

exec(open(foo.__file__).read(), foo.__dict__) was the best I could
come up with. That's frigging horrible, and it won't work unless
you've got access to the actual python source file of the module.

More information about the Python-list mailing list