[SciPy-User] Making Python Lazy

Jonathan Guyer guyer at nist.gov
Fri Sep 10 12:07:04 EDT 2010


FiPy has a lazy evaluate scheme built on top of numpy arrays. It's something I'd like to integrate more tightly with numpy, but have never found the time.

In our case, the calculation is (often) done once, in order to determine the shape (and physical units) of the result. Since FiPy is normally performing the same calculations thousands or millions of times, that one calculation is negligible, but it may be a problem for your application.

On Sep 9, 2010, at 6:25 AM, Lorenzo Isella wrote:

> Dear All,
> I hope this is not too off-topic.
> I am wondering if there is any possibility to make a Python code lazy 
> i.e. to prevent it from calculating quantities which are not used in the 
> code.
> As an example: you are in a rush to modify your code and at the end it 
> ends up with "dead branches", let's say an array which is calculated but 
> not used in any following calculations, not printed on screen, not 
> stored in a file etc...
> It would be nice to teach Python to automagically skip its calculation 
> when I run the script (at least in a non-interactive way).
> I know that such a situation is probably the result of bad programming 
> habits, but it may arise all the same.
> If I understand correctly, what I am asking for is something different 
> from garbage collection, which would take place, if ever, only after the 
> array has been calculated.
> Any suggestions (or clarifications if I am on the wrong track) are 
> appreciated.
> Cheers
> 
> Lorenzo
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list