kutsurak / python-bitstring

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

Documentation errors #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
According to the documentation on the bitstring website, __setitem__ should 
have the following behavior:

>>> s = BitArray('0x00112233')
>>> s[1:2:8] = '0xfff'
>>> print(s)
0x00fff2233
>>> s[-12:] = '0xc'
>>> print(s)
0x00fff2c

Ref:
http://packages.python.org/bitstring/bitarray.html?highlight=setitem

However, on my system the above code throws an error:

Python 2.6.7 (r267:88850, Apr  6 2012, 15:36:37) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bitstring
>>> print bitstring.__version__
3.0.2
>>> s = bitstring.BitArray('0x00112233')
>>> s[1:2:8] = '0xfff'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv-test/env/lib/python2.6/site-packages/bitstring.py", line 3065, in __setitem__
    temp.__setitem__(key, v)
ValueError: attempt to assign sequence of size 12 to extended slice of size 1

Original issue reported on code.google.com by dmlockh...@gmail.com on 23 Apr 2012 at 6:34

GoogleCodeExporter commented 9 years ago
Yes, you're right, the documentation is out of date there. The way that 
stepping works was changed in version 3 of bitstring, but the __setitem__ 
example is still using the version 2 meaning (as does __getitem__).

Thanks for pointing that out; it'll be fixed in the next update.

Original comment by dr.scott...@gmail.com on 23 Apr 2012 at 9:08

GoogleCodeExporter commented 9 years ago

Original comment by dr.scott...@gmail.com on 12 Jul 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Another minor doc problem: examples for insert() use a BitArray but the final 
part only works on a BitStream (it uses a default pos).

Original comment by dr.scott...@gmail.com on 30 Nov 2012 at 11:19

GoogleCodeExporter commented 9 years ago
Done in r.963.

Original comment by dr.scott...@gmail.com on 22 Feb 2013 at 5:52