Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reload() gone?
- From: arkanes at gmail.com (Chris Mellon)
- Subject: reload() gone?
- Date: Fri, 31 Aug 2007 16:25:00 -0500
On 8/31/07, Arnaud Delobelle <arnodel at googlemail.com> wrote: > On Aug 31, 7:10 pm, "Bernard Lebel" <3dbern... at gmail.com> wrote: > > I read in the Python 3.0 documentation that reload() was removed, > > without further explanations. > > > > http://docs.python.org/dev/3.0/whatsnew/3.0.html?highlight=reload > > > > 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.
- References:
- reload() gone?
- From: Arnaud Delobelle
- reload() gone?
- Prev by Date: [python 3.0] reload() gone?
- Next by Date: Is there a simple way to exit a while loop on keystroke?
- Previous by thread: reload() gone?
- Index(es):