Commit Graph

71 Commits

Author SHA1 Message Date
Raymond Hettinger b6b98c093e Track the cache size directly. 2012-04-29 18:09:02 -07:00
Raymond Hettinger 9f0ab9f564 Factor out shared variables. 2012-04-29 14:55:27 -07:00
Raymond Hettinger 678e7f3be6 Flatten the lru cache keyword args tuple for better memory utilization. 2012-04-29 12:28:02 -07:00
Raymond Hettinger c6897854f8 Fix-up a comment 2012-03-31 02:19:06 -07:00
Raymond Hettinger 7f7a5a7b87 Fix-up comments and add a sentinel variable for clarity. 2012-03-30 21:50:40 -07:00
Raymond Hettinger 41eb79a016 No need to create and destroy links when updating a fixed-sized circular queue. 2012-03-30 19:15:18 -07:00
Raymond Hettinger 1ff50df8bc Minor cleanup: add whitespace, add comments, bring function attribute updates together. 2012-03-30 13:15:48 -07:00
Raymond Hettinger 7dabfede34 Fix whitespace 2012-03-17 15:11:09 -07:00
Raymond Hettinger 7e0c581c49 Low overhead path for maxsize==0 2012-03-17 15:10:24 -07:00
Raymond Hettinger bc8e81dcc3 Section-off the source for better readability. 2012-03-17 00:24:09 -07:00
Raymond Hettinger dce583e0bd Minor beautification. 2012-03-16 22:12:20 -07:00
Raymond Hettinger 4f5139ba20 Root variable is not changed. 2012-03-16 17:08:37 -07:00
Raymond Hettinger 202d1ad3f6 Fix whitespace 2012-03-16 17:05:17 -07:00
Raymond Hettinger d37fb55910 Unique sentinel value for cache.get() 2012-03-16 17:04:11 -07:00
Raymond Hettinger 6e8c817687 Refactor calculation of the cache key. Minor code cleanups. 2012-03-16 16:53:05 -07:00
Benjamin Peterson 29a837d857 merge heads 2012-03-16 18:22:53 -05:00
Benjamin Peterson 954cf578c7 clear the root with the cache 2012-03-16 18:22:26 -05:00
Raymond Hettinger d656958915 Minor code cleanup. 2012-03-16 11:48:12 -07:00
Raymond Hettinger 57b2959d26 Eliminate duplicate link lookup. Minor cleanup. 2012-03-16 11:21:39 -07:00
Raymond Hettinger ec0e91045e Improve the memory utilization (and speed) of functools.lru_cache(). 2012-03-16 01:16:31 -07:00
Meador Inge ff7f64ca0e Issue #13544: Add __qualname__ to functools.WRAPPER_ASSIGNMENTS.
Patch by Filip Gruszczyński.
2011-12-11 22:37:31 -06:00
Raymond Hettinger cd9fdfd652 Issue 13227: Option to make the lru_cache() type specific (suggested by Andrew Koenig). 2011-10-20 08:57:45 -07:00
Raymond Hettinger d8886fc831 Merge 2011-10-16 00:00:51 -07:00
Raymond Hettinger 4b779b3785 Issue 13177: Make tracebacks more readable by avoiding chained exceptions in the lru_cache. 2011-10-15 23:50:42 -07:00
Raymond Hettinger 8cd2e5f751 Sync-up minor code edits with the default branch. 2011-05-05 14:15:12 -07:00
Raymond Hettinger e7a2430dde Fix __hash__ in functools.cmp_to_key() to work with collections.Hashable. 2011-05-03 11:16:36 -07:00
Raymond Hettinger 003be52932 Fix __hash__ in functools.cmp_to_key() to work with collections.Hashable. 2011-05-03 11:01:32 -07:00
Raymond Hettinger 7ab9e22e34 Issue #11707: Fast C version of functools.cmp_to_key() 2011-04-05 02:33:54 -07:00
Raymond Hettinger 0a4edd5435 Issue #11628: cmp_to_key should use __slots__. 2011-03-21 17:54:04 -07:00
Raymond Hettinger a0d1d96771 Issue #11628: cmp_to_key should use __slots__. 2011-03-21 17:50:28 -07:00
Raymond Hettinger 7e4c168385 Minor optimization -- factor a constant expression out of the inner-loop. 2011-03-18 15:09:10 -07:00
Raymond Hettinger 524359f9f7 Add comment. 2011-01-11 22:08:55 +00:00
Raymond Hettinger 23f9fc3448 Issue #10042: Fixed the total_ordering decorator to handle cross-type
comparisons that could lead to infinite recursion.
2011-01-08 07:01:56 +00:00
Raymond Hettinger c79fb0e52d Issue 10593: Adopt Nick's suggestion for an lru_cache with maxsize=None. 2010-12-01 03:45:41 +00:00
Raymond Hettinger 00f2f97dbd Doc and docstring nits. 2010-12-01 00:47:56 +00:00
Raymond Hettinger 7496b4171e Add example, tighten text, and minor clean-ups. 2010-11-30 19:15:45 +00:00
Raymond Hettinger 5e20bab422 Neaten-up a bit. 2010-11-30 07:13:04 +00:00
Nick Coghlan 234515afe5 Issue 10586: change the new functools.lru_cache implementation to expose the maximum and current cache sizes through the public statistics API. This API is now a single function that returns a named tuple. 2010-11-30 06:19:46 +00:00
Raymond Hettinger 5fa40c01ad Clean-up docstring, comments, and whitespace. 2010-11-25 08:11:57 +00:00
Raymond Hettinger 3255c63e28 Improve comment 2010-09-16 00:31:21 +00:00
Raymond Hettinger 1006bd459b Future proof total_ordering against changes in methods defined on object. 2010-09-14 22:55:13 +00:00
Raymond Hettinger bd88802c1f Revert r84700 which had an unfortunate performance cost. 2010-09-11 08:07:42 +00:00
Raymond Hettinger 22b46e0ba9 Separate positional arguments from localized globals. 2010-09-11 00:05:44 +00:00
Benjamin Peterson 1017ae5253 add reduce and partial to __all__ 2010-09-10 23:35:52 +00:00
Raymond Hettinger f45abc97bf Add method to OrderedDict for repositioning keys to the ends. 2010-09-06 21:26:09 +00:00
Raymond Hettinger 4c7c9af542 Clean-up functools.total_ordering(). 2010-09-05 05:57:35 +00:00
Raymond Hettinger 02566ec89f Adopt more descriptive attribute names as suggested on python-dev. 2010-09-04 22:46:06 +00:00
Raymond Hettinger af1e140334 Readability nit. 2010-09-02 19:58:35 +00:00
Raymond Hettinger 7babc1b6a5 Better method name. Tighten inner-loop with bound methods. 2010-09-02 19:56:28 +00:00
Raymond Hettinger 38d17e3df0 Speed-up cache updates 2010-09-02 09:44:28 +00:00