[Python-Dev] Re: [Import-sig] Re: Proposal for a modified import mechanism.
Thomas Heller
thomas.heller@ion-tof.com
Thu, 15 Nov 2001 08:40:10 +0100
From: "Just van Rossum" <just@letterror.com>
> Greg Ward wrote:
>
> > More importantly, it is fundamentally impossible for module
> > reloading to work in Python. Believe me, I've tried several times,
> > and each time I run up against the same brick wall: [ ..... ]
> >
> > If anyone has a solution to this, I'm all ears, but for now I'm pretty
> > well convinced that it cannot be done.
>
> Has anyone ever tried something like this:
>
> make a copy of module.__dict__
> module.__dict__.clear()
> execute source in module.__dict__
> for each function in module:
> assign new func attrs to *old* func object
> (possible for func_code, func_defaults, func_doc and func_dict)
> inject old (but updated!) func object back into module.__dict__
> for each class in module:
> for each func in class:
> <same as global functions>
> # XXX something with __bases__...
>
> ?
http://groups.google.com/groups?selm=9ss15a%2414snvc%242%40ID-59885.news.dfncis.de
Thomas