Posts: 4,653
Threads: 1,496
Joined: Sep 2016
Oct-18-2016, 07:08 AM
(This post was last modified: Oct-18-2016, 07:10 AM by Skaperen.)
i have this very simple script:
print()
that prints
Output:
()
but when i run 2to3 on it, it says
Output:
RefactoringTool: No files need to be modified.
D'oh!
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,653
Threads: 1,496
Joined: Sep 2016
(Oct-18-2016, 03:04 PM)nilamo Wrote: That's already a valid python3 file. So there isn't any conversion that needs to take place.
in python 2 it is a print statement that prints an empty tuple

so what if python3 can run it as-is

it does something different with it (prints an empty line)

no i did not read the docs of
2to3 so i was not aware of cases like this that it cannot figure out

let's see if you can write python 3 code that does what this code does in python 2 (it prints an empty tuple)

would you cheat and use the string '()'

i might
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,653
Threads: 1,496
Joined: Sep 2016
true, but that's not the challenge. the challenge is to get code that does the same thing now in python3 and keep it simple. how simple can it be done in python3? is this the best case?
print('()')
?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.