diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-05 05:38:52 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-05 05:38:52 (GMT) |
commit | a2f959169aff67901de95d9ea820c3d69119c39a (patch) | |
tree | 84272002e269223c68cc6bfd11fdc05742ccb728 /Doc/faq | |
parent | 0ae3525e85080c1e6a0abd101941f29465034b0d (diff) | |
parent | 9f6a239cf1890602b752cf5acb0d010778bebc02 (diff) | |
download | cpython-a2f959169aff67901de95d9ea820c3d69119c39a.zip cpython-a2f959169aff67901de95d9ea820c3d69119c39a.tar.gz cpython-a2f959169aff67901de95d9ea820c3d69119c39a.tar.bz2 |
#16862: merge with 3.3.
Diffstat (limited to 'Doc/faq')
-rw-r--r-- | Doc/faq/design.rst | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 5591264..04c8c1f 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 @@ -345,9 +345,6 @@ support for C. Answer 2: Fortunately, there is `Stackless Python <http://www.stackless.com>`_, which has a completely redesigned interpreter loop that avoids the C stack. -It's still experimental but looks very promising. Although it is binary -compatible with standard Python, it's still unclear whether Stackless will make -it into the core -- maybe it's just too revolutionary. Why can't lambda forms contain statements? @@ -709,7 +706,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)] @@ -734,7 +731,7 @@ languages. For example:: try: ... - if (condition): raise label() # goto label + if condition: raise label() # goto label ... except label: # where to goto pass |