On 3/16/2015 5:13 AM, INADA Naoki wrote:
Another experience is porting Flask application in my company from
Python 2 to Python 3.
It has 26k lines of code and 7.6k lines of tests.
Since we don't need to support both of PY2 and PY3, we used 2to3.
2to3 changes 740 lines.
That is less than 3% of the lines. Were any changes incorrect? How
many lines *not* flagged by 2to3 needed change?
I had to replace google-api-client with
requests+oauthlib since
it had not supported PY3 yet.
Other than those needed for this change, which 2to3 could not anticipate
or handle?
After that, we encountered few trouble with untested code. But Porting
effort is surprisingly small.
We're happy now with Python 3. We can write non-ascii string to log
without fear of UnicodeError.
We can use csv with unicode without hack.
People who use ascii only or perhaps one encoding everywhere severely
underestimate the benefit of unicode strings (and utf-8) everywhere.
Porting *modern* *application* code to *PY3 only* is easy, while
porting libraries on the edge of
bytes/unicode like google-api-client to PY2/3 is not easy.
I think application developers should use *only* Python 3 from this year.
If we start moving, more library developers will be able to start
writing Python 3 only code from next year.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list