Message108163
Whatever is done, I think a bytearray should be handled the same as bytes. It must be that they give the same result. In basic operations, I believe that bytearrays can *always* substitute for bytes. "Bytes and bytearray objects contain single bytes – the former is immutable while the latter is a mutable sequence." For example:
>>> b'abc'.capitalize()
b'Abc'
>>> bytearray(b'abc').capitalize()
bytearray(b'Abc')
This, to me, implies that .fromstring should accept bytearray (though probably not general buffer objects). In 2.x, I understand .fromstring to initialize an array from machine bytes read into a string, but not .fromunicode. This is *not* a text method, and the result may vary for 2 and 4-byte unicode builds. So I can see that 3.x needs .fromstring(bytes) but not .fromunicode(string). |
|
Date |
User |
Action |
Args |
2010-06-19 03:19:05 | terry.reedy | set | recipients:
+ terry.reedy, belopolsky, tjollans |
2010-06-19 03:19:04 | terry.reedy | set | messageid: <1276917544.76.0.76332890102.issue8990@psf.upfronthosting.co.za> |
2010-06-19 03:19:03 | terry.reedy | link | issue8990 messages |
2010-06-19 03:19:02 | terry.reedy | create | |
|