On Mon, Sep 28, 2009 at 12:11 AM, Maurizio <maurizio.gran...@gmail.com> wrote: > > First of all, thank you for the example! > >> >> I'm pretty sure it is impossible to decide whether a cells output depends on >> the >> value of a given variable. You could get it write some of the time by seeing >> if the variable appears, but given the dynamic nature of Python it is >> impossible to >> decide in general. >> > > What about the preparser? Can't we use it to recognize whether any > variable belonging to the "live" list appear in the lines of the > current cell? Then, it could just automatically append the "depend" > attribute to the cell id.
Sure, one could do that using the preparser. Unfortunately that wouldn't really work because one cell can easily depend on the variable x without the letter x explicitly appearing anywhere in the cell. For example, suppose I define a function: def foo(): print x in one cell, then put print foo() in another cell. The cell with "print foo()" in it depends on the value of x, but x is not mentioned explicitly anywhere in that cell. > >> That said, if you were allowed to tag a cell as depending, then this is easy >> to >> implement. I've even made an implementation of this in the current notebook: >> >> http://sagenb.org/home/pub/905/ >> >> If you try that and evaluate all the cells in order, then you'll see >> that changing a and b >> causes all the other dependent cells to update. You can add >> non-dependent cells and >> they won't update. Obviously the above is a bit cumbersome, but could >> be made smoother >> if it gets at what you're after. >> >> William >> > > After all, I'd be glad to see if any interest is shown in this > direction, since there is a reasonable amount of work around the > notebook now. Otherwise, thank you for the discussion :) > > Maurizio > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---