[Python-checkins] r62226 - in sandbox/trunk/2to3: example.py lib2to3/fixes/fix_dict.py lib2to3/tests/test_fixers.py

collin.winter python-checkins at python.org
Tue Apr 8 21:07:56 CEST 2008


Author: collin.winter
Date: Tue Apr 8 21:07:56 2008
New Revision: 62226
Modified:
 sandbox/trunk/2to3/example.py
 sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py
 sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
Log:
Add min() and max() to the list of special contexts that don't require adding list() calls around dict methods.
Modified: sandbox/trunk/2to3/example.py
==============================================================================
--- sandbox/trunk/2to3/example.py	(original)
+++ sandbox/trunk/2to3/example.py	Tue Apr 8 21:07:56 2008
@@ -363,4 +363,11 @@
 x = buffer(y)
 
 
+class X:
+ def maximum(self):
+ return max(self.data.values())
+ def total(self):
+ return sum(self.data.values())
+
+
 # This is the last line.
Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py	(original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py	Tue Apr 8 21:07:56 2008
@@ -31,7 +31,8 @@
 from .util import Name, Call, LParen, RParen, ArgList, Dot, set
 
 
-exempt = set(["sorted", "list", "set", "any", "all", "tuple", "sum"])
+exempt = set(["sorted", "list", "set", "any", "all", "tuple", "sum",
+ "min", "max"])
 iter_exempt = exempt | set(["iter"])
 
 
Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py	Tue Apr 8 21:07:56 2008
@@ -1103,7 +1103,8 @@
 self.check(b, a)
 
 def test_unchanged(self):
- wrappers = ["set", "sorted", "any", "all", "tuple", "sum"]
+ wrappers = ["set", "sorted", "any", "all", "tuple", "sum",
+ "min", "max"]
 for wrapper in wrappers:
 s = "s = %s(d.keys())" % wrapper
 self.unchanged(s)


More information about the Python-checkins mailing list

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