[Python-checkins] r56433 - in sandbox/trunk/2to3: fixes/fix_filter.py fixes/fix_map.py tests/test_fixers.py

collin.winter python-checkins at python.org
Tue Jul 17 23:13:04 CEST 2007


Author: collin.winter
Date: Tue Jul 17 23:13:04 2007
New Revision: 56433
Modified:
 sandbox/trunk/2to3/ (props changed)
 sandbox/trunk/2to3/fixes/fix_filter.py
 sandbox/trunk/2to3/fixes/fix_map.py
 sandbox/trunk/2to3/tests/test_fixers.py
Log:
Add set() to the list of special contexts for the map and filter fixers.
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 17 23:13:04 2007
@@ -64,7 +64,7 @@
 
 P1 = """
 power<
- ( 'iter' | 'list' | 'tuple' | 'sorted' )
+ ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' )
 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 17 23:13:04 2007
@@ -76,7 +76,7 @@
 
 P1 = """
 power<
- ( 'iter' | 'list' | 'tuple' | 'sorted' )
+ ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' )
 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 17 23:13:04 2007
@@ -2198,6 +2198,10 @@
 self.unchanged(a, a)
 a = """list(filter(f, 'abc'))[0]"""
 self.unchanged(a, a)
+ a = """set(filter(f, 'abc'))"""
+ self.unchanged(a)
+ a = """set(filter(f, 'abc')).pop()"""
+ self.unchanged(a)
 a = """tuple(filter(f, 'abc'))"""
 self.unchanged(a, a)
 a = """sorted(filter(f, 'abc'))"""
@@ -2259,6 +2263,10 @@
 self.unchanged(a)
 a = """list(map(f, 'abc'))[0]"""
 self.unchanged(a)
+ a = """set(map(f, 'abc'))"""
+ self.unchanged(a)
+ a = """set(map(f, 'abc')).pop()"""
+ self.unchanged(a)
 a = """tuple(map(f, 'abc'))"""
 self.unchanged(a)
 a = """sorted(map(f, 'abc'))"""


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /