Re: reload from ( was Python FAQ ... )

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Thu, 18 Nov 1993 10:18:42 -0500

On Nov 18, 13:25, Guido.van.Rossum@cwi.nl wrote:
>
> Actually, there's a flaw in this method. [ ... ]
>

While in the shower this morning it came to me that it appeared
a little *too* easy - how does it *DO* THAT? - and then I considered
that I hadn't tested it very thououghly. Yes - it does the executable
statements in the module, but it doesn't appear to rebind the new
definitions.

I was hoping it could retest and correct it before anyone else
discovered the flaw, but Guido had nl-time on his side! :-)

Guido> This can be rectified by repeating the "from xxx import *"
Guido> command; it will redo all the name bindings.

>>>from xxx import *
>>>yyy
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>editpy( 'xxx' )

[ ... edit xxx; change: yyy = range( 1, 4 ) ]

>>>yyy
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>from xxx import *
>>>yyy
[1, 2, 3]

Thanks,

- Steve