Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43535
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ethan@stoneleaf.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'encoding': 0.05; 'subject:Python': 0.06; 'skip:` 10': 0.07; 'apis': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'strings.': 0.09; 'subject:design': 0.09; 'subject:skip:c 10': 0.09; '~ethan~': 0.09; 'runs': 0.10; 'api': 0.11; 'python': 0.11; 'api,': 0.16; 'backward': 0.16; 'bump': 0.16; 'cleaner': 0.16; 'expects': 0.16; 'schwarzer': 0.16; 'subject:API': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'stefan': 0.19; 'version.': 0.19; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'unicode': 0.24; 'regardless': 0.24; 'developers': 0.25; '(see': 0.26; 'switch': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'returned': 0.30; 'program,': 0.31; 'code': 0.31; 'text': 0.33; 'version': 0.36; 'charset:us-ascii': 0.36; 'remote': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'supporting': 0.39; 'to:addr:python.org': 0.39; 'major': 0.40; 'subject: / ': 0.60; 'break': 0.61; 'received:173': 0.61; 'back': 0.62; 'kind': 0.63; 'different': 0.65; 'behavior': 0.77; 'reading,': 0.84 |
| Date | Sat, 13 Apr 2013 11:03:15 -0700 |
| From | Ethan Furman <ethan@stoneleaf.us> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: API design for Python 2 / 3 compatibility |
| References | <51698989.2070805@sschwarzer.net> |
| In-Reply-To | <51698989.2070805@sschwarzer.net> |
| Content-Type | text/plain; charset=us-ascii; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - gator410.hostgator.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - stoneleaf.us |
| X-BWhitelist | no |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| X-Source-Sender | ([173.12.184.235]) [173.12.184.235]:55805 |
| X-Source-Auth | ethan+stoneleaf.us |
| X-Email-Count | 1 |
| X-Source-Cap | dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.566.1365877587.3114.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365877587 news.xs4all.nl 2563 [2001:888:2000:d::a6]:54340 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43535 |
Show key headers only | View raw
On 04/13/2013 09:36 AM, Stefan Schwarzer wrote: > * Approach 2 > > When 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~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
API design for Python 2 / 3 compatibility Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2013-04-13 18:36 +0200 Re: API design for Python 2 / 3 compatibility Terry Jan Reedy <tjreedy@udel.edu> - 2013-04-13 13:32 -0400 Re: API design for Python 2 / 3 compatibility Ethan Furman <ethan@stoneleaf.us> - 2013-04-13 11:03 -0700 Re: API design for Python 2 / 3 compatibility Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2013-04-14 13:11 +0200
csiph-web