<div dir="ltr">Thank's Doug. Perfect simple example.<br></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><br>Jason<br><a href="http://moorepants.info" target="_blank">moorepants.info</a><br><span>+01 530-601-9791</span><br>

</div></div>
<br><br><div class="gmail_quote">On Wed, May 7, 2014 at 12:55 PM, Doug Blank <span dir="ltr"><<a href="mailto:doug.blank@gmail.com" target="_blank">doug.blank@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Wed, May 7, 2014 at 12:35 PM, Jason Moore <span dir="ltr"><<a href="mailto:moorepants@gmail.com" target="_blank">moorepants@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">What would be classic memoization in this application? Just store axes globally or something?<br>


</div></blockquote><div><br></div></div><div>Maybe something like:</div><div><br></div><div><a href="http://nbviewer.ipython.org/urls/bitbucket.org/ipre/calico/raw/master/notebooks/Python/Memoizing%20Fibs.ipynb" target="_blank">http://nbviewer.ipython.org/urls/bitbucket.org/ipre/calico/raw/master/notebooks/Python/Memoizing%20Fibs.ipynb</a><span class="HOEnZb"><font color="#888888"><br>


</font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Doug</div></font></span><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr">
</div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><br>Jason<br><a href="http://moorepants.info" target="_blank">moorepants.info</a><br>

<span>+01 <a href="tel:530-601-9791" value="+15306019791" target="_blank">530-601-9791</a></span><br></div></div><div><div>
<br><br><div class="gmail_quote">On Wed, May 7, 2014 at 4:41 AM, Matthias BUSSONNIER <span dir="ltr"><<a href="mailto:bussonniermatthias@gmail.com" target="_blank">bussonniermatthias@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
Le 6 mai 2014 à 23:31, Jason Moore a écrit :<br>
<div><div><br>
> If I have a function that makes a plot, for example:<br>
><br>
> def plot_something(parameter=1.0, view=1.0):<br>
>     axes = expensive_function(plt.gca(), parameter)<br>
>     less_expensive_function(axes, view)<br>
><br>
> And I make it interactive:<br>
><br>
> interactive(plot_something, parameter=(0.0, 1.0), view=(0.0, 1.0))<br>
><br>
> As it stands, both the expensive_function and the less_expensive_function run whether I drag the slider for either parameter, even though if I only drag the view parameter I could theoretically only call the less_expensive_function, thus making the widget respond faster.<br>





><br>
> What is a good design to have a widget depend on two or more parameters and be able to have internal knowledge in the callback function on what parameter changed? So that you can avoid overhead in computation?<br>
<br>
</div></div>I suppose this is possible by doing custom widget and/or using the comm architecture directly.<br>
But that would be a **lot** of work.<br>
But couldn't you just use classic memoization of the expensive_function so that recalling it becomes less expensive ?<br>
<span><font color="#888888"><br>
--<br>
M<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</font></span></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></blockquote></div><br></div>