<div>On Tue, Oct 19, 2010 at 12:17 PM, Peter Ingebretson <span dir="ltr"><<a href="mailto:pingebre@yahoo.com">pingebre@yahoo.com</a>></span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The builtin reload function is very useful for iterative development, but it is also limited.  Because references to types and functions in the old version of the module may persist after reloading, the builtin reload function is typically only useful in simple use cases.<br>

<br>
This is a proposal (pre-PEP?) for an enhanced reloading mechanism especially designed for iterative development:<br>
<br>
<a href="https://docs.google.com/document/pub?id=1GeVVC0pXTz1O6cK5mo-EaOJFqrL3PErO4okmHBlTeuw" target="_blank">https://docs.google.com/document/pub?id=1GeVVC0pXTz1O6cK5mo-EaOJFqrL3PErO4okmHBlTeuw</a><br>
<br>
The basic plan is to use the existing cycle-detecting GC to remap references from objects in the old module to equivalent objects in the new module.<br>
<br>
I have a patch against the current 3.2 branch that adds the gc.remap function (and unit tests, etc...) but not any of the additional reloading functionality.  I have a separate prototype of the reloading module as well, but it only implements a portion of the proposal (one module at a time, and dicts/sets are not fixed up).<br>

<br>
A few questions:<br>
<br>
1) Does this approach seem reasonable?  Has anyone tried something similar and run into unsolvable problems?<br>
<br>
2) Would there be interest in a PEP for enhanced reloading?  I would be happy to rewrite the proposal in PEP form if people think it would be worthwhile.<br>
<br>
3) Should I submit my gc.remap patch to the issue tracker?  Because the change to visitproc modifies the ABI I would like to get that portion of the proposal in before 3.2 goes final.  Since the bulk of the change is adding one method to the gc module I was hoping it might be accepted without requiring a PEP.<br>

<br>
<br></blockquote><div><br></div><div>What happens if you change the __init__ or __new__ methods of an object or if you change a class's metaclass? It seems like those types of changes would be impossible to propagate to existing objects, and without propagating them any changes to existing objects may (are likely?) to break the object.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</blockquote></div><br>