Closed GoogleCodeExporter closed 9 years ago
The step does have a function, but not the standard list one - it instead acts
as a multiplier for the start and stop. This is helpful if you want to specify
things in terms of bytes or other bit multiples (so s[a:b:c] is the same as
s[a*c:b*c]).
For the behaviour you seem to want there's not such a compact syntax. I'd be
interested to know what you need it for (I could never think of a use for it
which is why the other use for step was chosen). The best equivalent I can
think of is
s = ConstBitArray().join(m[i:i+1] for i in range(start, stop, step))
If all you want to do is check that all or any of the bits are set/unset then
you can use something like
m.all(True, range(start, stop, step))
or
m.any(False, range(start, stop, step))
Original comment by dr.scott...@gmail.com
on 18 Apr 2011 at 10:44
The standard step functionality would be useful when retrieving a column from a
2D bit array, and probably in other situations too. The current functionality
doesn't appear to have caught on, so consider switching to more usual meaning
in version 3.0.
Original comment by dr.scott...@gmail.com
on 18 Jun 2011 at 6:24
Done for version 3.0.
Original comment by dr.scott...@gmail.com
on 20 Nov 2011 at 9:16
Original issue reported on code.google.com by
andrea.z...@gmail.com
on 18 Apr 2011 at 9:34