Message108161
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? |
|
Date |
User |
Action |
Args |
2010-06-19 02:17:28 | belopolsky | set | recipients:
+ belopolsky, terry.reedy, tjollans |
2010-06-19 02:17:27 | belopolsky | set | messageid: <1276913847.19.0.845404724031.issue8990@psf.upfronthosting.co.za> |
2010-06-19 02:17:25 | belopolsky | link | issue8990 messages |
2010-06-19 02:17:25 | belopolsky | create | |
|