[Python-ideas] Bitwise operations on bytes class
Chris Angelico
rosuav at gmail.com
Tue Jun 17 02:03:24 CEST 2014
On Tue, Jun 17, 2014 at 10:00 AM, Greg Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Chris Angelico wrote:
>>
>> I presume you're aware that the bytes type is immutable, right? You're
>> still going to have at least some copying going on, whereas with a
>> mutable type you might well be able to avoid that. Efficiency suggests
>> bytearray instead.
>
>
> Why not both?
If you do a series of operations on a large bytes object, each one
will involve a full copy. If you do the same series of operations on a
large mutable object, they can be optimized down to non-copying. Why
both?
ChrisA
More information about the Python-ideas
mailing list