Normalizing arguments
Dan Ellis
dan at remember.this.name
Fri Oct 17 13:37:43 EDT 2008
On Oct 17, 6:17 pm, "Chris Rebert" <c... at rebertia.com> 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
More information about the Python-list
mailing list