kutsurak / python-bitstring

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

Slices return views rather than copies #97

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Similar to how numpy works, an idea is to have slices return a view of the 
bitstring rather than a copy. Would have to wait until version 3, and quite a 
lot to think about.

* Should this just be for Bits or for BitString too? In a BitString modifying 
the view will change the original too (plus other views). Much less 
controversial for Bits (and possible perhaps in the 2.x series?)
* How does garbage collection work? Are there going to be any terrible 
use-cases? E.g. Create from very large file, take little slice, delete original.
* How much user code will this break. Are there simple translations?
* How much faster (if at all) will it be. After all, that's the underlying 
reason for trying it.
* Is an 'original' different to a 'view' in any distinguishable way?
* Presumably reads and peeks will also return views.

Original issue reported on code.google.com by dr.scott...@gmail.com on 21 Aug 2010 at 11:34

GoogleCodeExporter commented 9 years ago
This has essentially been done for Bits in rev 795. As they are immutable there 
isn't much controversy here.

Original comment by dr.scott...@gmail.com on 30 Sep 2010 at 2:34