[Python-checkins] r56163 - in sandbox/trunk/2to3: fixes/fix_filter.py fixes/fix_map.py tests/test_fixers.py
guido.van.rossum
python-checkins at python.org
Tue Jul 3 18:43:37 CEST 2007
Author: guido.van.rossum
Date: Tue Jul 3 18:43:36 2007
New Revision: 56163
Modified:
sandbox/trunk/2to3/fixes/fix_filter.py
sandbox/trunk/2to3/fixes/fix_map.py
sandbox/trunk/2to3/tests/test_fixers.py
Log:
Fix a problem where a filter() or map() call inside another call was always ignored
(instead of only when the called function was iter(), list(), tuple() or sorted()).
Modified: sandbox/trunk/2to3/fixes/fix_filter.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_filter.py (original)
+++ sandbox/trunk/2to3/fixes/fix_filter.py Tue Jul 3 18:43:36 2007
@@ -66,7 +66,7 @@
P1 = """
power<
- NAME< 'iter' | 'list' | 'tuple' | 'sorted' >
+ ( 'iter' | 'list' | 'tuple' | 'sorted' )
trailer< '(' node=any ')' >
any*
>
Modified: sandbox/trunk/2to3/fixes/fix_map.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_map.py (original)
+++ sandbox/trunk/2to3/fixes/fix_map.py Tue Jul 3 18:43:36 2007
@@ -78,7 +78,7 @@
P1 = """
power<
- NAME< 'iter' | 'list' | 'tuple' | 'sorted' >
+ ( 'iter' | 'list' | 'tuple' | 'sorted' )
trailer< '(' node=any ')' >
any*
>
Modified: sandbox/trunk/2to3/tests/test_fixers.py
==============================================================================
--- sandbox/trunk/2to3/tests/test_fixers.py (original)
+++ sandbox/trunk/2to3/tests/test_fixers.py Tue Jul 3 18:43:36 2007
@@ -1866,8 +1866,8 @@
a = """x = list(filter(None, 'abc'))"""
self.check(b, a)
- b = """x = filter(f, 'abc')"""
- a = """x = list(filter(f, 'abc'))"""
+ b = """x = len(filter(f, 'abc'))"""
+ a = """x = len(list(filter(f, 'abc')))"""
self.check(b, a)
b = """x = filter(lambda x: x%2 == 0, range(10))"""
@@ -1909,8 +1909,8 @@
a = """x = list(map(f, 'abc'))"""
self.check(b, a)
- b = """x = map(f, 'abc', 'def')"""
- a = """x = list(map(f, 'abc', 'def'))"""
+ b = """x = len(map(f, 'abc', 'def'))"""
+ a = """x = len(list(map(f, 'abc', 'def')))"""
self.check(b, a)
b = """x = map(None, 'abc')"""
More information about the Python-checkins
mailing list