<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 27 June 2014 13:58, Mark Voorhies <span dir="ltr"><<a href="mailto:mark.voorhies@ucsf.edu" target="_blank">mark.voorhies@ucsf.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If I wanted to take a crack at it, what are the best entry points for capturing object creation?</blockquote>
</div><br></div><div class="gmail_extra">I can see two potential ways to do it:<br><br></div><div class="gmail_extra">1. Scan the AST for assignments when we execute cells. You can add an ast.NodeVisitor instance to shell.ast_transfomers (docs here: <a href="http://ipython.org/ipython-doc/dev/config/inputtransforms.html#ast-transformations">http://ipython.org/ipython-doc/dev/config/inputtransforms.html#ast-transformations</a> ).<br>
<br></div><div class="gmail_extra">2. Run with the user_ns as a dict subclass that records on __setitem__. I don't actually know whether the exec machinery will use that indirection, or add items to the dict at a lower level that bypasses that.<br>
<br></div><div class="gmail_extra">Thomas<br></div></div>