Re: Technique for safely reloading dynamically generated module

2016-07-21 Thread Terry Reedy
On 7/21/2016 12:07 PM, Malcolm Greene wrote: I assume that one downside to the exec() approach is that there is no persistent namespace for this code's functions and classes, eg. after the exec() completes, its namespace disappears and is not available to code that follows? Objects only

Re: Technique for safely reloading dynamically generated module

2016-07-21 Thread Chris Angelico
On Fri, Jul 22, 2016 at 2:07 AM, Malcolm Greene wrote: > The source file we're generating has one main function (go) with some > supporting functions and classes as well. Will there be any problems > referencing additional functions or classes defined in the source that > gets

Re: Technique for safely reloading dynamically generated module

2016-07-21 Thread Malcolm Greene
Thank you Chris and Peter. The source file we're generating has one main function (go) with some supporting functions and classes as well. Will there be any problems referencing additional functions or classes defined in the source that gets passed to exec ... as long as references to those

Re: Technique for safely reloading dynamically generated module

2016-07-21 Thread Peter Otten
Malcolm Greene wrote: > We're designing a server application that parses a custom DSL (domain > specific language) source file, generates a Python module with the > associated logic, and runs the associated code. Since this is a server > application, we need to reload the module after each

Re: Technique for safely reloading dynamically generated module

2016-07-21 Thread Chris Angelico
On Fri, Jul 22, 2016 at 12:42 AM, Malcolm Greene wrote: > We're designing a server application that parses a custom DSL (domain > specific language) source file, generates a Python module with the > associated logic, and runs the associated code. Since this is a server >

Technique for safely reloading dynamically generated module

2016-07-21 Thread Malcolm Greene
We're designing a server application that parses a custom DSL (domain specific language) source file, generates a Python module with the associated logic, and runs the associated code. Since this is a server application, we need to reload the module after each regeneration. Is this process is