This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients belopolsky, terry.reedy, tjollans
Date 2010-06-19.02:17:25
SpamBayes Score 0.0065975017
Marked as misclassified No
Message-id <1276913847.19.0.845404724031.issue8990@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2010-06-19 02:17:28belopolskysetrecipients: + belopolsky, terry.reedy, tjollans
2010-06-19 02:17:27belopolskysetmessageid: <1276913847.19.0.845404724031.issue8990@psf.upfronthosting.co.za>
2010-06-19 02:17:25belopolskylinkissue8990 messages
2010-06-19 02:17:25belopolskycreate