<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hey Aaron,<br>
<br>
Thanks for the suggestions. Sorry if I wasn't clear in my OP - my
question is more along the lines of how to refactor safely without
restarting the kernel. Both the methods below would require that. <br>
<br>
<blockquote type="cite">The fact that the ipynb saves all your
variables in memory is great, but it makes refactoring a little
more tricky since you have to remember to delete your old
function/variable names.</blockquote>
Here's where I think I should clarify - I mean deleting the
function/variable names *from the kernel's memory.* Even if you
delete the names from the notebook, they'll still exist in the
kernel. Hence if you miss renaming a function call in the notebook
somewhere, it'll still use the old function resident in the kernel's
memory - even though the old function never appears in the notebook.
That can make bugs tricky to track down unless you restart the
kernel.<br>
<br>
Cheers,<br>
<br>
-g<br>
<br>
On 7/14/2012 10:46 AM, Aaron Meurer wrote:
<blockquote cite="mid:-3966567546257305415@unknownmsgid" type="cite">
<div>If the variable name is a fairly unique one, you could do a
find and replace in the JSON itself using a text editor. I think
there might also be a way to export the notebook to a .py file
and reimport it, in which case you can use any Python
refactoring tool under the sun (others will have to say how to
do this or correct me if I'm wrong here). <br>
<br>
Aaron Meurer</div>
<div><br>
On Jul 14, 2012, at 10:55 AM, "<a moz-do-not-send="true"
href="mailto:junkshops@gmail.com">junkshops@gmail.com</a>"
<<a moz-do-not-send="true" href="mailto:junkshops@gmail.com">junkshops@gmail.com</a>>
wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<p>The fact that the ipynb saves all your variables in memory
is great, but it makes refactoring a little more tricky
since you have to remember to delete your old
function/variable names. Otherwise, if you miss changing a
name somewhere it can lead to hard to fix bugs since the old
variable/function still exists but is invisible to the user.
</p>
<p>How do people deal with this other than being extremely
careful when refactoring? I've taken to restarting the
kernel after I make extensive changes to make sure I haven't
forgotten to delete any variables, but I assume some of the
more experienced users have better methods. I'd definitely
be interested in suggestions.</p>
<p>Cheers, Gavin</p>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>IPython-User mailing list</span><br>
<span><a moz-do-not-send="true"
href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a></span><br>
<span><a moz-do-not-send="true"
href="http://mail.scipy.org/mailman/listinfo/ipython-user">http://mail.scipy.org/mailman/listinfo/ipython-user</a></span><br>
</div>
</blockquote>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
IPython-User mailing list
<a class="moz-txt-link-abbreviated" href="mailto:IPython-User@scipy.org">IPython-User@scipy.org</a>
<a class="moz-txt-link-freetext" href="http://mail.scipy.org/mailman/listinfo/ipython-user">http://mail.scipy.org/mailman/listinfo/ipython-user</a>
</pre>
</blockquote>
</body>
</html>