[Python-checkins] r53725 - sandbox/trunk/2to3/refactor.py

guido.van.rossum python-checkins at python.org
Sat Feb 10 20:38:59 CET 2007


Author: guido.van.rossum
Date: Sat Feb 10 20:38:59 2007
New Revision: 53725

Modified:
   sandbox/trunk/2to3/refactor.py
Log:
Add -p option which assumes print() is a function, not a keyword.


Modified: sandbox/trunk/2to3/refactor.py
==============================================================================
--- sandbox/trunk/2to3/refactor.py	(original)
+++ sandbox/trunk/2to3/refactor.py	Sat Feb 10 20:38:59 2007
@@ -47,6 +47,8 @@
                       help="Each FIX specifies a transformation; default all")
     parser.add_option("-l", "--list-fixes", action="store_true",
                       help="List available transformations (fixes/fix_*.py)")
+    parser.add_option("-p", "--print-function", action="store_true",
+                      help="Modify the grammar so that print() is a function")
     parser.add_option("-v", "--verbose", action="store_true",
                       help="More verbose logging")
     parser.add_option("-w", "--write", action="store_true",
@@ -99,6 +101,8 @@
         self.options = options
         self.errors = []
         self.logger = logging.getLogger("RefactoringTool")
+        if self.options.print_function:
+            del pygram.python_grammar.keywords["print"]
         self.driver = driver.Driver(pygram.python_grammar,
                                     convert=pytree.convert,
                                     logger=self.logger)


More information about the Python-checkins mailing list