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 terry.reedy
Recipients belopolsky, terry.reedy, tjollans
Date 2010-06-19.03:19:02
SpamBayes Score 0.0026558996
Marked as misclassified No
Message-id <1276917544.76.0.76332890102.issue8990@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2010-06-19 03:19:05terry.reedysetrecipients: + terry.reedy, belopolsky, tjollans
2010-06-19 03:19:04terry.reedysetmessageid: <1276917544.76.0.76332890102.issue8990@psf.upfronthosting.co.za>
2010-06-19 03:19:03terry.reedylinkissue8990 messages
2010-06-19 03:19:02terry.reedycreate