Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'binary': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:between': 0.16; 'header:User-Agent:1': 0.23; 'skip': 0.24; 'unicode': 0.24; 'header:X-Complaints-To:1': 0.27; 'header :In-Reply-To:1': 0.27; 'text': 0.33; 'skip:s 30': 0.35; 'something': 0.35; '8bit%:86': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'subject:skip:S 10': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Serhiy Storchaka Subject: Re: Surprising difference between StringIO.StringIO and io.StringIO Date: Fri, 31 May 2013 12:39:41 +0300 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 95.111.168.85 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369993195 news.xs4all.nl 15984 [2001:888:2000:d::a6]:46875 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46586 30.05.13 23:46, Skip Montanaro написав(ла): > Am I missing something about how io.StringIO works? I thought it was > a more-or-less drop-in replacement for StringIO.StringIO. io.StringIO was backported from Python 3. It is a text (unicode) stream. cStringIO.StringIO is a binary stream and StringIO.StringIO can be used as binary or unicode stream depending on arguments. Use io.BaseIO as a replacement for StringIO.StringIO/cStringIO.StringIO if you need a binary stream.