~ubuntu-branches/ubuntu/saucy/python3.3/saucy-proposed

« back to all changes in this revision

Viewing changes to Doc/library/functools.rst

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-05-15 21:42:49 UTC
  • mfrom: (1.2.9) (22.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130515214249-otmm671u8fiylkc2
Tags: 3.3.2-1ubuntu1
Regenerate the control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
   Example of an LRU cache for static web content::
81
81
 
82
 
        @lru_cache(maxsize=20)
 
82
        @lru_cache(maxsize=32)
83
83
        def get_pep(num):
84
84
            'Retrieve text of a Python Enhancement Proposal'
85
85
            resource = 'http://www.python.org/dev/peps/pep-%04d/' % num
93
93
        ...     pep = get_pep(n)
94
94
        ...     print(n, len(pep))
95
95
 
96
 
        >>> print(get_pep.cache_info())
97
 
        CacheInfo(hits=3, misses=8, maxsize=20, currsize=8)
 
96
        >>> get_pep.cache_info()
 
97
        CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)
98
98
 
99
99
   Example of efficiently computing
100
100
   `Fibonacci numbers <http://en.wikipedia.org/wiki/Fibonacci_number>`_
108
108
                return n
109
109
            return fib(n-1) + fib(n-2)
110
110
 
111
 
        >>> print([fib(n) for n in range(16)])
 
111
        >>> [fib(n) for n in range(16)]
112
112
        [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]
113
113
 
114
 
        >>> print(fib.cache_info())
 
114
        >>> fib.cache_info()
115
115
        CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)
116
116
 
117
117
   .. versionadded:: 3.2