+1 on attaching the functions directly instead of via a dictionary, for all the reasons above.  How often is a dict of callbacks useful? Is it common to add callbacks at runtime -- is that the reason for the dict of funcs?<div>
<br></div><div>chris<span></span><br><br>On Sunday, July 8, 2012, Casey W. Stark  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+1 on Andrew's point. I like using yt interactively, but that behavior drives me crazy. If memory serves, numpy auto-imports so many things for this same reason.<div>
<br></div><div>- Casey</div><div><br><br><div class="gmail_quote">

On Sun, Jul 8, 2012 at 9:44 PM, Andrew Myers <span dir="ltr"><<a href="javascript:_e({}, 'cvml', 'atmyers@berkeley.edu');" target="_blank">atmyers@berkeley.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Data point: as someone used to using <TAB> and "?" in ipython to familiarize myself with new classes, I definitely found the current "dictionary of functions" thing a bit inconvenient / confusing when I first started to use yt. In addition to <TAB> not giving a list of available callbacks in the current code, I find that I can't do:<br>



<br><div style="margin-left:40px">In [5]: p.modify["grids"]?<br>Object `p.modify["grids"]` not found.<br><br></div>but instead have to do:<br><br><div style="margin-left:40px">In [9]: func = p.modify["grids"]<br>



<br>In [10]: func?<br>Type:           function<br>Base Class:     <type 'function'><br>String Form:    <function GridBoundaryCallback at 0x43c65f0><br>Namespace:      Interactive<br>File:           /u/atmyers/yt-x86_64/lib/python2.7/site-packages/yt-2.4dev-py2.7-linux-x86_64.egg/yt/visualization/plot_types.py<br>



Definition:     func(*args, **kwargs)<br>Docstring:<br>    <no docstring><br>Constructor Docstring:<br>    Adds grid boundaries to a plot, optionally with *alpha*-blending.<br>    Cuttoff for display is at *min_pix* wide.<br>



    *annotate* puts the grid id in the corner of the grid.  (Not so great in projections...)<br>Call def:       func(self, plot)   <br></div><br>if I need to look up the argument list for one of the callbacks. Just my $0.02. <br>


<span><font color="#888888">
<br>-Andrew Myers</font></span><div><div><br><br><div class="gmail_quote">On Sun, Jul 8, 2012 at 8:10 PM, Nathan Goldbaum <span dir="ltr"><<a href="javascript:_e({}, 'cvml', 'goldbaum@ucolick.org');" target="_blank">goldbaum@ucolick.org</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
Matt and I have been thinking about how to port the already existing callbacks to the new Plot Window plotting interface.  We've come down to two choices that we'd like to the put to the list to vote on.<br>
<br>
The first choice is to leave the interface exactly the same and use dict-like access through a .modify member that hangs off the PlotWindow object.  So, for example, if you wanted to add grids to a plot, it would look something like this:<br>




<br>
>> slc = SlicePlot(pf, 0, 'Density')<br>
>> slc.modify['grids']()<br>
<br>
Alternatively, the callbacks could hang off of the plot window object as attributes:<br>
<br>
>> slc = SlicePlot(pf, 0, 'Density')<br>
>> slc.annotate_grids()<br>
<br>
Personally, I prefer the second choice since it leaves the list of annotations available at runtime.  In ipython, for example, I could say slc.annotate<tab> and then get a list of all of the available plot modifications for this object.<br>




<br>
Both choices are about equally complicated syntactically since the attributes can be dynamically generated based on a list of available callbacks in plot_modifications.py.<br>
<br>
If you have an opinion, please reply with a vote for your preferred option.<br>
<br>
Cheers,<br>
<br>
Nathan Goldbaum<br>
_______________________________________________<br>
yt-dev mailing list<br>
<a href="javascript:_e({}, 'cvml', 'yt-dev@lists.spacepope.org');" target="_blank">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
yt-dev mailing list<br>
<a href="javascript:_e({}, 'cvml', 'yt-dev@lists.spacepope.org');" target="_blank">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
<br></blockquote></div><br></div>
</blockquote></div>