Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

Thomas' patch does more than just allow bytearray.  It allows any object that 
can present itself as a buffer with byte-size items.  It is a bit unfortunate 
that such method will end up being called "fromstring" in 3.x.    With string 
being unicode, this is hopelessly ambiguous. Is the string interpreted as array 
of bytes, UTF-8 style, 16 or 32-bit integers?  It would be much better to have 
frombuffer, and even better extendfrombuffer method with this functionality.

I am +1 on Terry's option 2.  It may be possible to optimize .extend to detect 
objects that support buffer interface and bypass iterator protocol.  Of course, 
when receiving array is not type 'b', extend and fromxyz are not the same, so 
maybe we should just rename fromunicode to fromstring and fromstring to 
frombytes?

----------
nosy: +belopolsky

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to