N
neil
what are the advantages? if it wasn't for python 3 breaking backwards
compatibility would it be the better choice?
compatibility would it be the better choice?
neil said:what are the advantages? if it wasn't for python 3 breaking backwards
compatibility would it be the better choice?
what are the advantages? if it wasn't for python 3 breaking backwards
compatibility would it be the better choice?
IMHO the killer app for Python 3 is in more reasonable support for
foreign character sets (no matter where your are, at least one out of
the hundred-odd Unicode character sets is going to be foreign,) and
generally internationalized data processing.
Well, actually Unicode support went in back around Python 2.4.
In 3.x, ASCII strings went away, but that was more of a removal.
You're trying to split bytes with a str (Unicode) argument. Try this:On Tue, Apr 5, 2011 at 10:04 PM, Terry Reedy <[email protected]
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.Traceback (most recent call last):'a/b/c'.split('/') ['a', 'b', 'c']
b'a/b/c'.split('/')
On 06/04/2011 07:06, Dan Stromberg wrote:
Traceback (most recent call last):'a/b/c'.split('/') ['a', 'b', 'c']
b'a/b/c'.split('/')
File "<stdin>", line 1, in <module>
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'b', b'c']
You're trying to split bytes with a str (Unicode) argument. Try this:On Tue, Apr 5, 2011 at 10:04 PM, Terry Reedy <[email protected]
On 4/5/2011 4:42 PM, John Nagle wrote:
Well, actually Unicode support went in back around Python2.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 "<stdin>", line 1, in <module>
TypeError: Type str doesn't support the buffer API
>>>
[b'a', b'b', b'c']
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.