On Wed, 2 Jul 2003, J Cameron Cooper wrote:
Then you should create one method to get the dynamic data and pass that as parameters to the methods that make your images. Perhaps this might be the most clever method.
1) Generate a random number with a high (or guaranteed, if you're feeling over-acheiving) probability of uniqueness. I guess tempfile.mktemp() is my friend here...
2)Call your first method with a parameter being that number. It generates and returns your image, and caches the data the second method needs somehow under an index accessible by the number you gave it. (Like by filename.)
3) Call the second method with its parameter being the same index number. It retreives the cached data and creates its image. Perhaps it also flushes the cached value. For one moment I've thought about that but I'm not sure in how far those methods might possibly run in parallel and the second method might try to acces a not existing tempfile.
This works with any type of data created by the first method, even if it's random, by making a snapshot and providing the index to it. It's also somewhat fragile as described, because it depends on order of call, but I think you can imagine how to fix that. Probably you don't need to be this complex, and can use the simplified case I suggested above (the one using three methods.) Or you can use one of the previous suggestions that makes sense. Thanks for the hints
Andreas.