[SciPy-User] Making Python Lazy

David Baddeley david_baddeley@yahoo.com...
Thu Sep 9 07:30:44 CDT 2010

Hi Lorenzo, 

I've got something which I use to perform coordinate transformations which might 
give you some ideas ...

it basically stores a set of mappings and only executes them on demand.

I've attached a slightly simplified version


----- Original Message ----
From: Lorenzo Isella <lorenzo.isella@gmail.com>
To: scipy-user@scipy.org
Sent: Thu, 9 September, 2010 10:25:37 PM
Subject: [SciPy-User] Making Python Lazy

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 
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 

SciPy-User mailing list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lazyTest.py
Type: application/octet-stream
Size: 2360 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20100909/13c7671e/attachment.obj 

More information about the SciPy-User mailing list