Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46561

Re: Surprising difference between StringIO.StringIO and io.StringIO

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'binary': 0.07; 'cc:addr :python-list': 0.11; 'python': 0.11; '1.2.': 0.16; 'expecting': 0.16; 'expects': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'subject:between': 0.16; 'sender:addr:gmail.com': 0.17; 'thanks.': 0.20; 'appears': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; 'basis,': 0.24; 'skip': 0.24; 'switched': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'context,': 0.31; 'probably': 0.32; 'stuff': 0.32; 'text': 0.33; 'objects': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'expect': 0.39; 'between': 0.67; 'subject:skip:S 10': 0.84; 'whereas': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=yJi7hUZxoQEsWERLi9dxGKl8tMHfwJ6anuzHfiGb/vs=; b=WmmRpD74CdmuBegEPh514ZkZEeNK/sDMshTRQ74uZaLdxHkU/OcsjD+v7Ns319KE4I 3gk8il7CyWGIUqi7GytNMuws0rJN+bCJCk5Xx9PcmuPp7mi9tGPVlwDk+SOxm2+QrCpU +gJVOMHc1sKlXKZzuuTk/bngdZm5wokAFYhqSSEsYP0/a0Q/zYITRsdWQKPrvwNLV6/q 9E82gSTojB0E0j/TjjZlqDSFoAcDlzxENtiPY0YsRmpxuXvFJg5UZ4dlv76gOrKQqcXY M3e/VlQ3MJGE9NbIih0oynJ91VivW4ykCankEWeRMOhDSoIRnKNZpjjxxe1astP013GQ jTMQ==
MIME-Version 1.0
X-Received by 10.50.60.41 with SMTP id e9mr444932igr.94.1369957388158; Thu, 30 May 2013 16:43:08 -0700 (PDT)
Sender skip.montanaro@gmail.com
In-Reply-To <20130530231519.GA77870@cskk.homeip.net>
References <CANc-5UyDZ=ArzKrs=Y9CDwNwOunDt3DGpy5KKATZ_R=Z-LsHtA@mail.gmail.com> <20130530231519.GA77870@cskk.homeip.net>
Date Thu, 30 May 2013 18:43:08 -0500
X-Google-Sender-Auth pQdqVSMM3n58oTlTEplYzGRPI2c
Subject Re: Surprising difference between StringIO.StringIO and io.StringIO
From Skip Montanaro <skip@pobox.com>
To Cameron Simpson <cs@zip.com.au>
Content-Type multipart/alternative; boundary=047d7b10cea57a8eb204ddf80fe0
Cc Python <python-list@python.org>
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.2466.1369957812.3114.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369957812 news.xs4all.nl 15947 [2001:888:2000:d::a6]:47206
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46561

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

>
> I would expect io.StringIO to be a match for the io.* stuff in Python
> 3. So it should care whether it is a binary stream or a text stream.
> Whereas StringIO.StringIO is your good old Python 2 StringIO, which expects
> strs.
>
> On that basis, io.StringIO is a text stream, expecting Unicode
> objects for transcription. 'str' is, in that context, probably
> considered as 'bytes' in Python 3.
>

Thanks.  This example was based on a function in Matplotlib. It appears the
author switched from StringIO.StringIO to io.StringIO between 1.1 and 1.2.

Skip

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Surprising difference between StringIO.StringIO and io.StringIO Skip Montanaro <skip@pobox.com> - 2013-05-30 18:43 -0500

csiph-web