Index: Lib/CGIHTTPServer.py =================================================================== --- Lib/CGIHTTPServer.py (revision 47131) +++ Lib/CGIHTTPServer.py (working copy) @@ -321,7 +321,7 @@ 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 Index: Lib/stringold.py =================================================================== --- Lib/stringold.py (revision 47131) +++ Lib/stringold.py (working copy) @@ -388,7 +388,7 @@ raise ValueError, "maketrans arguments must have same length" global _idmapL if not _idmapL: - _idmapL = map(None, _idmap) + _idmapL = list(_idmap) L = _idmapL[:] fromstr = map(ord, fromstr) for i in range(len(fromstr)): Index: Lib/tabnanny.py =================================================================== --- Lib/tabnanny.py (revision 47131) +++ Lib/tabnanny.py (working copy) @@ -260,7 +260,7 @@ 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" Index: Lib/textwrap.py =================================================================== --- Lib/textwrap.py (revision 47131) +++ Lib/textwrap.py (working copy) @@ -67,10 +67,8 @@ whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace)) - unicode_whitespace_trans = {} uspace = ord(u' ') - for x in map(ord, _whitespace): - unicode_whitespace_trans[x] = uspace + unicode_whitespace_trans = dict.fromkeys(map(ord, _whitespace), uspace) # This funky little regex is just the trick for splitting # text up into word-wrappable chunks. E.g. Index: Lib/distutils/dist.py =================================================================== --- Lib/distutils/dist.py (revision 47131) +++ Lib/distutils/dist.py (working copy) @@ -113,8 +113,7 @@ ('obsoletes', None, "print the list of packages/modules made obsolete") ] - display_option_names = map(lambda x: translate_longopt(x[0]), - display_options) + display_option_names = [translate_longopt(x[0]) for x in display_options] # negative options are options that exclude other options negative_opt = {'quiet': 'verbose'} Index: Lib/distutils/command/build_ext.py =================================================================== --- Lib/distutils/command/build_ext.py (revision 47131) +++ Lib/distutils/command/build_ext.py (working copy) @@ -204,7 +204,7 @@ if self.define: defines = string.split(self.define, ',') - self.define = map(lambda symbol: (symbol, '1'), defines) + self.define = [(symbol, '1') for symbol in defines] # The option for macros to undefine is also a string from the # option parsing, but has to be a list. Multiple symbols can also Index: Lib/compiler/pycodegen.py =================================================================== --- Lib/compiler/pycodegen.py (revision 47131) +++ Lib/compiler/pycodegen.py (working copy) @@ -905,7 +905,7 @@ level = node.level if level == 0 and not self.graph.checkFlag(CO_FUTURE_ABSIMPORT): level = -1 - fromlist = map(lambda (name, alias): name, node.names) + fromlist = [name for name, alias in node.names] if VERSION > 1: self.emit('LOAD_CONST', level) self.emit('LOAD_CONST', tuple(fromlist)) Index: Lib/inspect.py =================================================================== --- Lib/inspect.py (revision 47131) +++ Lib/inspect.py (working copy) @@ -701,7 +701,7 @@ def strseq(object, convert, join=joinseq): """Recursively walk a sequence, stringifying each element.""" if type(object) in (list, tuple): - return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object)) + return join([strseq(o, convert, join) for o in object]) else: return convert(object) Index: Lib/string.py =================================================================== --- Lib/string.py (revision 47131) +++ Lib/string.py (working copy) @@ -69,7 +69,7 @@ raise ValueError, "maketrans arguments must have same length" global _idmapL if not _idmapL: - _idmapL = map(None, _idmap) + _idmapL = list(_idmap) L = _idmapL[:] fromstr = map(ord, fromstr) for i in range(len(fromstr)): Index: Lib/Cookie.py =================================================================== --- Lib/Cookie.py (revision 47131) +++ Lib/Cookie.py (working copy) @@ -316,7 +316,7 @@ if "" == translate(str, idmap, LegalChars): return str else: - return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"' + return '"' + _nulljoin( _Translator.get(s, s) for s in str ) + '"' # end _quote Index: Lib/pydoc.py =================================================================== --- Lib/pydoc.py (revision 47131) +++ Lib/pydoc.py (working copy) @@ -666,7 +666,7 @@ 'Modules', '#fffff', '#aa55cc', contents) if classes: - classlist = map(lambda (key, value): value, classes) + classlist = [value for (key, value) in classes] contents = [ self.formattree(inspect.getclasstree(classlist, 1), name)] for key, value in classes: @@ -971,13 +971,12 @@ 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.""" if not text: return '' - lines = split(text, '\n') - lines = map(lambda line, prefix=prefix: prefix + line, lines) + lines = [prefix + line for line in split(text, '\n')] if lines: lines[-1] = rstrip(lines[-1]) return join(lines, '\n') @@ -995,7 +994,7 @@ 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([]): @@ -1059,7 +1058,7 @@ 'PACKAGE CONTENTS', join(modpkgs, '\n')) if classes: - classlist = map(lambda (key, value): value, classes) + classlist = [value for key, value in classes] contents = [self.formattree( inspect.getclasstree(classlist, 1), name)] for key, value in classes: Index: Lib/plat-riscos/rourl2path.py =================================================================== --- Lib/plat-riscos/rourl2path.py (revision 47131) +++ Lib/plat-riscos/rourl2path.py (working copy) @@ -43,7 +43,7 @@ del components[i] else: i += 1 - components = map(lambda x: urllib.unquote(x).translate(__slash_dot), components) + components = [urllib.unquote(x).translate(__slash_dot) for x in components] return '.'.join(components) def pathname2url(pathname): Index: Lib/lib-tk/Tkinter.py =================================================================== --- Lib/lib-tk/Tkinter.py (revision 47131) +++ Lib/lib-tk/Tkinter.py (working copy) @@ -869,10 +869,10 @@ includeids and 'includeids' or None)) if type(data) is StringType: data = [self.tk.split(data)] - return map(self.__winfo_parseitem, data) + return [self.__winfo_parseitem(x) for x in data] def __winfo_parseitem(self, t): """Internal function.""" - return t[:1] + tuple(map(self.__winfo_getint, t[1:])) + return t[:1] + tuple(self.__winfo_getint(x) for x in t[1:]) def __winfo_getint(self, x): """Internal function.""" return int(x, 0) @@ -1204,8 +1204,8 @@ self.configure({key: value}) def keys(self): """Return a list of all resource names of this widget.""" - return map(lambda x: x[0][1:], - self.tk.split(self.tk.call(self._w, 'configure'))) + return [x[0][1:] for x + in self.tk.split(self.tk.call(self._w, 'configure'))] def __str__(self): """Return the window path name of this widget.""" return self._w Index: Lib/rexec.py =================================================================== --- Lib/rexec.py (revision 47131) +++ Lib/rexec.py (working copy) @@ -255,7 +255,7 @@ m = self.copy_only(sys, self.ok_sys_names) m.modules = self.modules m.argv = ['RESTRICTED'] - m.path = map(None, self.ok_path) + m.path = list(self.ok_path) m.exc_info = self.r_exc_info m = self.modules['sys'] l = self.modules.keys() + list(self.ok_builtin_modules) Index: Lib/test/pystone.py =================================================================== --- Lib/test/pystone.py (revision 47131) +++ Lib/test/pystone.py (working copy) @@ -72,7 +72,7 @@ Char1Glob = '\0' Char2Glob = '\0' Array1Glob = [0]*51 -Array2Glob = map(lambda x: x[:], [Array1Glob]*51) +Array2Glob = [x[:] for x in [Array1Glob]*51] PtrGlb = None PtrGlbNext = None Index: Lib/test/test_long.py =================================================================== --- Lib/test/test_long.py (revision 47131) +++ Lib/test/test_long.py (working copy) @@ -23,7 +23,7 @@ MAXDIGITS = 15 # build some special values -special = map(long, [0, 1, 2, BASE, BASE >> 1]) +special = [long(n) for n in [0, 1, 2, BASE, BASE >> 1]] special.append(0x5555555555555555L) special.append(0xaaaaaaaaaaaaaaaaL) # some solid strings of one bits @@ -33,8 +33,7 @@ p2 = p2 << 1 del p2 # add complements & negations -special = special + map(lambda x: ~x, special) + \ - map(lambda x: -x, special) +special = special + [~x for x in special] + [-x for x in special] class LongTest(unittest.TestCase): @@ -208,7 +207,7 @@ digits = digits or [0] return '-'[:sign] + \ {8: '0', 10: '', 16: '0x'}[base] + \ - "".join(map(lambda i: "0123456789abcdef"[i], digits)) + "L" + "".join("0123456789abcdef"[i] for i in digits) + "L" def check_format_1(self, x): for base, mapper in (8, oct), (10, repr), (16, hex): Index: Lib/test/test_cgi.py =================================================================== --- Lib/test/test_cgi.py (revision 47131) +++ Lib/test/test_cgi.py (working copy) @@ -122,10 +122,10 @@ return list def first_elts(list): - return map(lambda x:x[0], list) + return [x[0] for x in list] def first_second_elts(list): - return map(lambda p:(p[0], p[1][0]), list) + return [(p[0], p[1][0]) for p in list] def main(): for orig, expect in parse_qsl_test_cases: Index: Lib/test/test_binascii.py =================================================================== --- Lib/test/test_binascii.py (revision 47131) +++ Lib/test/test_binascii.py (working copy) @@ -74,8 +74,8 @@ res += c return res + noise + line res = "" - for line in map(addnoise, lines): - b = binascii.a2b_base64(line) + for line in lines: + b = binascii.a2b_base64(addnoise(line)) res += b self.assertEqual(res, self.data) Index: Lib/test/test_pwd.py =================================================================== --- Lib/test/test_pwd.py (revision 47131) +++ Lib/test/test_pwd.py (working copy) @@ -59,7 +59,7 @@ namei = 0 fakename = allnames[namei] while fakename in bynames: - chars = map(None, fakename) + chars = list(fakename) for i in xrange(len(chars)): if chars[i] == 'z': chars[i] = 'A' @@ -76,7 +76,7 @@ except IndexError: # should never happen... if so, just forget it break - fakename = ''.join(map(None, chars)) + fakename = ''.join(chars) self.assertRaises(KeyError, pwd.getpwnam, fakename) Index: Lib/test/test_decimal.py =================================================================== --- Lib/test/test_decimal.py (revision 47131) +++ Lib/test/test_decimal.py (working copy) @@ -170,7 +170,7 @@ return self.eval_equation(s) def eval_directive(self, s): - funct, value = map(lambda x: x.strip().lower(), s.split(':')) + funct, value = [x.strip().lower() for x in s.split(':')] if funct == 'rounding': value = RoundingDict[value] else: Index: Lib/test/test_grp.py =================================================================== --- Lib/test/test_grp.py (revision 47131) +++ Lib/test/test_grp.py (working copy) @@ -54,7 +54,7 @@ namei = 0 fakename = allnames[namei] while fakename in bynames: - chars = map(None, fakename) + chars = list(fakename) for i in xrange(len(chars)): if chars[i] == 'z': chars[i] = 'A' @@ -71,7 +71,7 @@ except IndexError: # should never happen... if so, just forget it break - fakename = ''.join(map(None, chars)) + fakename = ''.join(chars) self.assertRaises(KeyError, grp.getgrnam, fakename) Index: Lib/plat-mac/videoreader.py =================================================================== --- Lib/plat-mac/videoreader.py (revision 47131) +++ Lib/plat-mac/videoreader.py (working copy) @@ -156,7 +156,7 @@ elif nch == 2: channels = ['left', 'right'] else: - channels = map(lambda x: str(x+1), range(nch)) + channels = [str(x+1) for x in range(nch)] if bps % 8: # Funny bits-per sample. We pretend not to understand blocksize = 0 Index: Lib/hmac.py =================================================================== --- Lib/hmac.py (revision 47131) +++ Lib/hmac.py (working copy) @@ -6,7 +6,7 @@ def _strxor(s1, s2): """Utility method. XOR the two strings s1 and s2 (must have same length). """ - return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), s1, s2)) + return "".join(chr(ord(x) ^ ord(y)) for x, y in zip(s1, s2)) # The size of the digests returned by HMAC depends on the underlying # hashing module used. Index: Lib/poplib.py =================================================================== --- Lib/poplib.py (revision 47131) +++ Lib/poplib.py (working copy) @@ -297,7 +297,7 @@ raise error_proto('-ERR APOP not supported by server') import hashlib digest = hashlib.md5(m.group(1)+secret).digest() - digest = ''.join(map(lambda x:'%02x'%ord(x), digest)) + digest = ''.join('%02x' % ord(x) for x in digest) return self._shortcmd('APOP %s %s' % (user, digest))