I'm working on the renaming of str8 -> bytes and bytes -> buffer.
PyBytes (old bytes, new buffer) can take a string together with an
encoding and an optional error argument:


>>> bytes(source="abc", encoding="ascii", errors="replace")
b'abc'
>>> str(b"abc", encoding="ascii")
'abc'

IMO this should work
>>> str8("abc", encoding="ascii")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'encoding' is an invalid keyword argument for this function

And this should break with a type error
>>> str8("abc")
b'abc'


PyString' constructor doesn't take strings (PyUnicode). I like to add
the support for strings to it. It makes the API of str, bytes and buffer
consistent and fixes a *lot* of broken code and tests.

Are you confused by the name changes? I'm sometimes confused so I made a
table:

 c name   |  old  |   new  |  repr
-------------------------------------------
PyUnicode | str   |   -    | ''
PyString  | str8  | bytes  | b''
PyBytes   | bytes | buffer | buffer(b'')

Christian
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to