kutsurak / python-bitstring

Automatically exported from code.google.com/p/python-bitstring
0 stars 0 forks source link

Add a bytearray interpretation #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
So as well as

   s.bytes

allow

   s.bytearray

with the same semantics. Useful if that's what you want, but more importantly 
we currently use the bytearray internally, so if you want to extract it then we 
cast it to bytes then you'd have to recast it back again, which can't be 
optimal!

I suppose we should also have a bytearray initialiser for symmetry.

Original issue reported on code.google.com by dr.scott...@gmail.com on 15 Jul 2011 at 10:34

GoogleCodeExporter commented 9 years ago

Original comment by dr.scott...@gmail.com on 21 Nov 2011 at 11:04

GoogleCodeExporter commented 9 years ago
Thinking about it, we certainly don't want the user to have a reference to the 
mutable bytearray that's being used in the bitstring, so any initialisation or 
interpretation would have to include a copy in any case. So nothing is really 
gained from a bytearray interpretation except mild confusion.

Original comment by dr.scott...@gmail.com on 6 Feb 2012 at 7:35