Radomir Dopieralski added the comment:

Actually, after looking closer, my @memoize_method decorator does something 
completely different than Serhiy suggested. Still it only solves the common 
case of methods, and does nothing if you pass your short-lived objects as other 
parameters than self.

Limiting the cache size is also not a solution in the practical example with 
request that I linked to in the previous comment, because we can't know in 
advance how many times per request the function is going to be called, picking 
an arbitrary number feels wrong and may lead to unexpected behaviors when other 
fragments of code change (like a sudden slowdown every N calls).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19859>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to