Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'modified': 0.05; 'think,': 0.05; '3.2': 0.07; 'ascii': 0.07; 'terry': 0.07; 'tue': 0.07; 'python': 0.07; 'bytes,': 0.09; 'from:addr:python': 0.09; 'str': 0.09; 'api': 0.11; 'pm,': 0.11; 'this:': 0.11; '>>>': 0.12; 'slightly': 0.12; 'wrote:': 0.14; 'subject:python': 0.15; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '[gcc': 0.16; 'earlier,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'linux2': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reedy': 0.16; 'removal.': 0.16; 'reply-to:addr:python-list': 0.16; 'type:': 0.16; 'traceback': 0.16; '(most': 0.16; 'bytes': 0.19; 'tue,': 0.20; 'header:In-Reply-To:1': 0.22; 'trying': 0.23; 'last):': 0.23; 'received:84': 0.25; 'suspect': 0.25; 'feb': 0.26; 'skip:b 20': 0.27; 'fixed': 0.27; "doesn't": 0.28; 'string': 0.29; 'subject:?': 0.29; 'unicode': 0.29; 'cmd': 0.31; 'typeerror:': 0.31; "skip:' 10": 0.32; 'to:addr:python-list': 0.32; 'actually': 0.34; 'there': 0.35; 'file': 0.35; 'header:User-Agent:1': 0.35; '"",': 0.35; 'reply-to:addr:python.org': 0.35; 'problems': 0.37; 'some': 0.37; 'apr': 0.38; 'strings': 0.38; 'but': 0.38; 'no.': 0.38; 'to:addr:python.org': 0.39; 'split': 0.60; 'back': 0.61; '2011': 0.62; 'reply-to:no real name:2**0': 0.72; 'header:Reply- To:1': 0.72; 'kept': 0.73; '(unicode)': 0.84; '10:04': 0.84; 'subject:better': 0.93 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApIIAGqUnE3Unw4S/2dsb2JhbACYbI0Md4h5uTOFbASRHw Date: Wed, 06 Apr 2011 17:31:08 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: is python 3 better than python 2? References: <4d9b7eaa$0$10570$742ec2ed@news.sonic.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org 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: 39 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302107467 news.xs4all.nl 81473 [::ffff:82.94.164.166]:47939 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:2709 On 06/04/2011 07:06, Dan Stromberg wrote: > > On Tue, Apr 5, 2011 at 10:04 PM, Terry Reedy > wrote: > > On 4/5/2011 4:42 PM, John Nagle wrote: > > Well, actually Unicode support went in back around Python 2.4. > > > Even earlier, I think, but there were and still are problems with > unicode in 2.x. Some were and will only be fixed in 3.x. > > > In 3.x, ASCII strings went away, but that was more of a removal. > > > Yes and no. They were kept slightly modified as bytes, with all of > the string methods kept. > > > I suspect not all string methods were kept for the bytes type: > $ /usr/local/cpython-3.2/bin/python > cmd started 2011 Tue Apr 05 11:05:08 PM > Python 3.2 (r32:88445, Feb 20 2011, 16:47:11) > [GCC 4.4.5] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> 'a/b/c'.split('/') > ['a', 'b', 'c'] > >>> b'a/b/c'.split('/') > Traceback (most recent call last): > File "", line 1, in > TypeError: Type str doesn't support the buffer API > >>> > You're trying to split bytes with a str (Unicode) argument. Try this: >>> b'a/b/c'.split(b'/') [b'a', b'b', b'c']