[New-bugs-announce] [issue22294] 2to3 consuming_calls: len, min, max, zip, map, reduce, filter, dict, xrange

Edward O report at bugs.python.org
Thu Aug 28 13:43:01 CEST 2014


New submission from Edward O:

This is a patch for issues similar to #16573
With this patch, the following new tests are now unchanged:

r = dict(zip(s, range(len(s))), **d)
r = len(filter(attrgetter('t'), self.a))
r = min(map(methodcaller('f'), self.a))
max(map(node.id, self.nodes)) + 1 if self.nodes else 0
reduce(set.union, map(f, self.a))

Note that as part of the patch, the range transformation now calls the generic in_special_context in addition to the customized one (which. I guess, should be removed, but I didn't dare).

All existing tests pass, but the patterns used may not be strict enough, though I tried to stick to how it was done for other consuming calls.

M Lib/lib2to3/fixer_util.py
M Lib/lib2to3/fixes/fix_xrange.py
M Lib/lib2to3/tests/test_fixers.py

----------
components: 2to3 (2.x to 3.x conversion tool)
files: 2to3_more_consuming_calls.diff
hgrepos: 271
keywords: patch
messages: 226019
nosy: eddygeek
priority: normal
severity: normal
status: open
title: 2to3 consuming_calls:  len, min, max, zip, map, reduce, filter, dict, xrange
type: enhancement
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36495/2to3_more_consuming_calls.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22294>
_______________________________________


More information about the New-bugs-announce mailing list