Merged revisions 76884-76885,76887,76889-76890,76895 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k
................
r76884 | georg.brandl | 2009-12-19 18:35:49 +0100 (Sa, 19 Dez 2009) | 9 lines
Merged revisions 76883 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76883 | georg.brandl | 2009-12-19 18:34:32 +0100 (Sa, 19 Dez 2009) | 1 line
#7521: remove Py_GetBuildNumber(), which was removed in favor of Py_GetBuildInfo().
........
................
r76885 | georg.brandl | 2009-12-19 18:36:20 +0100 (Sa, 19 Dez 2009) | 1 line
#7521: remove PyEval_GetRestricted() from the docs.
................
r76887 | georg.brandl | 2009-12-19 18:46:40 +0100 (Sa, 19 Dez 2009) | 9 lines
Recorded merge of revisions 76886 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76886 | georg.brandl | 2009-12-19 18:43:33 +0100 (Sa, 19 Dez 2009) | 1 line
#7493: review of Design FAQ by Florent Xicluna.
........
................
r76889 | georg.brandl | 2009-12-19 18:57:51 +0100 (Sa, 19 Dez 2009) | 1 line
#7499: Review of Library FAQ by Florent Xicluna.
................
r76890 | georg.brandl | 2009-12-19 18:59:59 +0100 (Sa, 19 Dez 2009) | 1 line
#7500: add "Python 3 review needed" comments and fix a few obvious errors.
................
r76895 | georg.brandl | 2009-12-19 19:23:28 +0100 (Sa, 19 Dez 2009) | 1 line
#7380: Fix some str/bytearray/bytes issues in uuid docs and implementation.
................
diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst
index c20de00..8e960f5 100644
--- a/Doc/faq/design.rst
+++ b/Doc/faq/design.rst
@@ -234,8 +234,10 @@
.. XXX talk about protocols?
-Note that for string operations Python has moved from external functions (the
-``string`` module) to methods. However, ``len()`` is still a function.
+.. note::
+
+ For string operations, Python has moved from external functions (the
+ ``string`` module) to methods. However, ``len()`` is still a function.
Why is join() a string method instead of a list or tuple method?
@@ -306,14 +308,15 @@
This only made sense when you expected the dict to have the key almost all the
time. If that wasn't the case, you coded it like this::
- if dict.has_key(key):
+ if key in dict(key):
value = dict[key]
else:
dict[key] = getvalue(key)
value = dict[key]
-(In Python 2.0 and higher, you can code this as ``value = dict.setdefault(key,
-getvalue(key))``.)
+For this specific case, you could also use ``value = dict.setdefault(key,
+getvalue(key))``, but only if the ``getvalue()`` call is cheap enough because it
+is evaluated in all cases.
Why isn't there a switch or case statement in Python?
@@ -750,7 +753,7 @@
# Callers will never provide a third parameter for this function.
def expensive (arg1, arg2, _cache={}):
- if _cache.has_key((arg1, arg2)):
+ if (arg1, arg2) in _cache:
return _cache[(arg1, arg2)]
# Calculate the value