On Oct 17, 12:37 pm, Dan Ellis <[EMAIL PROTECTED]> wrote: > On Oct 17, 6:17 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > > > Why do you want/need this magical g() function considering that, as > > you yourself point out, Python already performs this normalization for > > you? > > A caching idea I'm playing around with. > > @cache > def some_query(arg1, arg2): > # Maybe do SQL query or something > return result > > cache returns a function that does: > - Make a key from its arguments > - If key is in the cache: > - Return result from cache > - If it isn't: > - Call some_query with the same arguments > - Cache and return the result
George Sakkis has a recipe that might help. http://code.activestate.com/recipes/551779/ It was discussed here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/91a24f281c59d4a4/31357f9cb4c7bdeb?lnk=st&q=#31357f9cb4c7bdeb -- http://mail.python.org/mailman/listinfo/python-list