[IPython-dev] How to have independent call backs for single widget
Jason Moore
moorepants at gmail.com
Wed May 7 14:24:13 EDT 2014
Thank's Doug. Perfect simple example.
Jason
moorepants.info
+01 530-601-9791
On Wed, May 7, 2014 at 12:55 PM, Doug Blank <doug.blank at gmail.com> wrote:
> On Wed, May 7, 2014 at 12:35 PM, Jason Moore <moorepants at gmail.com> wrote:
>
>> What would be classic memoization in this application? Just store axes
>> globally or something?
>>
>
> Maybe something like:
>
>
> http://nbviewer.ipython.org/urls/bitbucket.org/ipre/calico/raw/master/notebooks/Python/Memoizing%20Fibs.ipynb
>
> -Doug
>
>
>>
>>
>> Jason
>> moorepants.info
>> +01 530-601-9791
>>
>>
>> On Wed, May 7, 2014 at 4:41 AM, Matthias BUSSONNIER <
>> bussonniermatthias at gmail.com> wrote:
>>
>>>
>>> Le 6 mai 2014 à 23:31, Jason Moore a écrit :
>>>
>>> > If I have a function that makes a plot, for example:
>>> >
>>> > def plot_something(parameter=1.0, view=1.0):
>>> > axes = expensive_function(plt.gca(), parameter)
>>> > less_expensive_function(axes, view)
>>> >
>>> > And I make it interactive:
>>> >
>>> > interactive(plot_something, parameter=(0.0, 1.0), view=(0.0, 1.0))
>>> >
>>> > 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.
>>> >
>>> > 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?
>>>
>>> I suppose this is possible by doing custom widget and/or using the comm
>>> architecture directly.
>>> But that would be a **lot** of work.
>>> But couldn't you just use classic memoization of the expensive_function
>>> so that recalling it becomes less expensive ?
>>>
>>> --
>>> M
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140507/43217c98/attachment.html>
More information about the IPython-dev
mailing list