On 04/13/2013 09:36 AM, Stefan Schwarzer wrote:
* Approach 2When opening remote text files for reading, ftputil will always return unicode strings from `read(line/s)`, regardless of whether it runs under Python 2 or Python 3. Pro: Uniform API, independent on underlying Python version. Pro: Supporting a single API will result in cleaner code in ftputil than when supporting different APIs (see above). Con: This approach might break some code which expects the returned strings under Python 2 to be byte strings. Con: Developers who only use Python 2 might be confused if ftputil returns unicode strings from `read(line/s)` since this behavior doesn't match files opened with `open` in Python 2. Which approach do you recommend and why do you prefer that approach?
Approach 2, because it is much saner to deal with unicode inside the program, and only switch back to some kind of encoding when writing to files/pipes/etc. Since you are going to support python 3 as well you can bump the major version number and note the backward incompatibility.
-- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
