[Python-checkins] r54507 - sandbox/trunk/2to3/fixes/fix_numliterals.py

collin.winter python-checkins at python.org
Wed Mar 21 23:03:07 CET 2007


Author: collin.winter
Date: Wed Mar 21 23:03:02 2007
New Revision: 54507

Modified:
   sandbox/trunk/2to3/fixes/fix_numliterals.py
Log:
Take advantage of fixes.util.Number(); add copyright, authorship information.

Modified: sandbox/trunk/2to3/fixes/fix_numliterals.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_numliterals.py	(original)
+++ sandbox/trunk/2to3/fixes/fix_numliterals.py	Wed Mar 21 23:03:02 2007
@@ -3,11 +3,14 @@
 
 This is so simple that we don't need the pattern compiler.
 """
+# Copyright 2007 Georg Brandl.
+# Licensed to PSF under a Contributor Agreement.
 
 # Local imports
 import pytree
 from pgen2 import token
 from fixes import basefix
+from fixes.util import Number
 
 
 class FixNumliterals(basefix.BaseFix):
@@ -33,6 +36,4 @@
         elif val.startswith('0') and val.isdigit() and len(set(val)) > 1:
             val = "0o" + val[1:]
 
-        new = pytree.Leaf(token.NUMBER, val)
-        new.set_prefix(node.get_prefix())
-        return new
+        return Number(val, prefix=node.get_prefix())


More information about the Python-checkins mailing list