summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-04 10:39:14 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-04 10:39:14 (GMT)
commitcbd2ab1311120efa37e6dd8008a234235bf97b62 (patch)
treeaa1fbd5bf7fc5d236956c4b73cbbd407b9612349
parent8334fd9285a8e9f0864b0453ae738fe3f6893b21 (diff)
downloadcpython-cbd2ab1311120efa37e6dd8008a234235bf97b62.zip
cpython-cbd2ab1311120efa37e6dd8008a234235bf97b62.tar.gz
cpython-cbd2ab1311120efa37e6dd8008a234235bf97b62.tar.bz2
#1513299: cleanup some map() uses where a comprehension works better.
-rw-r--r--Lib/http/cookies.py2
-rw-r--r--Lib/http/server.py2
-rwxr-xr-xLib/pydoc.py4
-rwxr-xr-xLib/tabnanny.py2
-rwxr-xr-xLib/test/pystone.py2
-rw-r--r--Lib/test/test_long.py2
6 files changed, 7 insertions, 7 deletions
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py
index 9e51b67..fb9589c 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -230,7 +230,7 @@ def _quote(str, LegalChars=_LegalChars):
if all(c in LegalChars for c in str):
return str
else:
- return '"' + _nulljoin(map(_Translator.get, str, str)) + '"'
+ return '"' + _nulljoin(_Translator.get(s, s) for s in str) + '"'
_OctalPatt = re.compile(r"\\[0-3][0-7][0-7]")
diff --git a/Lib/http/server.py b/Lib/http/server.py
index 5ebfd25..2140710 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -868,7 +868,7 @@ def nobody_uid():
try:
nobody = pwd.getpwnam('nobody')[2]
except KeyError:
- nobody = 1 + max(map(lambda x: x[2], pwd.getpwall()))
+ nobody = 1 + max(x[2] for x in pwd.getpwall())
return nobody
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index da3702d..ea282f7 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1000,7 +1000,7 @@ class TextDoc(Doc):
def bold(self, text):
"""Format a string in bold by overstriking."""
- return ''.join(map(lambda ch: ch + '\b' + ch, text))
+ return ''.join(ch + '\b' + ch for ch in text)
def indent(self, text, prefix=' '):
"""Indent text by prepending a given prefix to each line."""
@@ -1024,7 +1024,7 @@ class TextDoc(Doc):
c, bases = entry
result = result + prefix + classname(c, modname)
if bases and bases != (parent,):
- parents = map(lambda c, m=modname: classname(c, m), bases)
+ parents = (classname(c, modname) for c in bases)
result = result + '(%s)' % ', '.join(parents)
result = result + '\n'
elif type(entry) is type([]):
diff --git a/Lib/tabnanny.py b/Lib/tabnanny.py
index a4d4ef0..46f8163 100755
--- a/Lib/tabnanny.py
+++ b/Lib/tabnanny.py
@@ -264,7 +264,7 @@ class Whitespace:
return a
def format_witnesses(w):
- firsts = map(lambda tup: str(tup[0]), w)
+ firsts = (str(tup[0]) for tup in w)
prefix = "at tab size"
if len(w) > 1:
prefix = prefix + "s"
diff --git a/Lib/test/pystone.py b/Lib/test/pystone.py
index aad4d8c..d7f1ec9 100755
--- a/Lib/test/pystone.py
+++ b/Lib/test/pystone.py
@@ -72,7 +72,7 @@ BoolGlob = FALSE
Char1Glob = '\0'
Char2Glob = '\0'
Array1Glob = [0]*51
-Array2Glob = list(map(lambda x: x[:], [Array1Glob]*51))
+Array2Glob = [x[:] for x in [Array1Glob]*51]
PtrGlb = None
PtrGlbNext = None
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 133702e..12197ee 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -276,7 +276,7 @@ class LongTest(unittest.TestCase):
digits = digits or [0]
return '-'[:sign] + \
{2: '0b', 8: '0o', 10: '', 16: '0x'}[base] + \
- "".join(map(lambda i: "0123456789abcdef"[i], digits))
+ "".join("0123456789abcdef"[i] for i in digits)
def check_format_1(self, x):
for base, mapper in (8, oct), (10, repr), (16, hex):