Message146475
$ cat deleteme.py
from string import lowercase, uppercase, letters
print uppercase == 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print lowercase == 'abcdefghijklmnopqrstuvwxyz'
print letters == 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
$ python deleteme.py
True
True
True
$ 2to3 -w deleteme.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored deleteme.py
--- deleteme.py (original)
+++ deleteme.py (refactored)
@@ -1,4 +1,4 @@
from string import lowercase, uppercase, letters
-print uppercase == 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-print lowercase == 'abcdefghijklmnopqrstuvwxyz'
-print letters == 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+print(uppercase == 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
+print(lowercase == 'abcdefghijklmnopqrstuvwxyz')
+print(letters == 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
RefactoringTool: Files that were modified:
RefactoringTool: deleteme.py
$ python3 deleteme.py
Traceback (most recent call last):
File "deleteme.py", line 1, in <module>
from string import lowercase, uppercase, letters
ImportError: cannot import name lowercase
They should be renamed to ascii_*. |
|
Date |
User |
Action |
Args |
2011-10-27 07:27:05 | ezio.melotti | set | recipients:
+ ezio.melotti, benjamin.peterson |
2011-10-27 07:27:05 | ezio.melotti | set | messageid: <1319700425.9.0.635731429373.issue13272@psf.upfronthosting.co.za> |
2011-10-27 07:27:05 | ezio.melotti | link | issue13272 messages |
2011-10-27 07:27:04 | ezio.melotti | create | |
|