diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-05 05:36:54 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-05 05:36:54 (GMT) |
commit | 9beeefbb450529723c5c2673be2373324adcc077 (patch) | |
tree | 4bee3c0a27894f381ca5e665b7cbe26e9d0c1aff /Doc/faq/design.rst | |
parent | 19cdee891ed1320c7f6c6ec54df7d4c838bdc317 (diff) | |
download | cpython-9beeefbb450529723c5c2673be2373324adcc077.zip cpython-9beeefbb450529723c5c2673be2373324adcc077.tar.gz cpython-9beeefbb450529723c5c2673be2373324adcc077.tar.bz2 |
Cleanup a few minor things.
Diffstat (limited to 'Doc/faq/design.rst')
-rw-r--r-- | Doc/faq/design.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 44931fd..30a0197 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -214,7 +214,7 @@ The major reason is history. Functions were used for those operations that were generic for a group of types and which were intended to work even for objects that didn't have methods at all (e.g. tuples). It is also convenient to have a function that can readily be applied to an amorphous collection of objects when -you use the functional features of Python (``map()``, ``apply()`` et al). +you use the functional features of Python (``map()``, ``zip()`` et al). In fact, implementing ``len()``, ``max()``, ``min()`` as a built-in function is actually less code than implementing them as methods for each type. One can @@ -707,7 +707,7 @@ of each call to the function, and return the cached value if the same value is requested again. This is called "memoizing", and can be implemented like this:: # Callers will never provide a third parameter for this function. - def expensive (arg1, arg2, _cache={}): + def expensive(arg1, arg2, _cache={}): if (arg1, arg2) in _cache: return _cache[(arg1, arg2)] @@ -732,7 +732,7 @@ languages. For example:: try: ... - if (condition): raise label() # goto label + if condition: raise label() # goto label ... except label: # where to goto pass |