Bitsets in Python
Matt
matt_crypto at yahoo.co.uk
Thu Feb 5 08:50:57 EST 2004
Josiah Carlson <jcarlson at nospam.uci.edu> wrote:
> > does Python have any native support for bitsets? I dont seem to see
> > anything in the standard library?
>
> What do you mean 'bitsets'? Give a list of functionality of your
> 'bitsets', and it will be easy for us to tell you whether Python
> includes it.
BitSets crop up in (at least) C++ and Java. They allow you operate on
a sequence of bits using a friendlier interface than hacking about
with ^,|,& et al on integers. The Java BitSet interface:
http://java.sun.com/j2se/1.4.1/docs/api/java/util/BitSet.html
I can't find anything like it in the standard library (If I've
overlooked it, I'd be chuffed to find out I'm wrong!). The OP might
find the following Cookbook recipe useful, though:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300
(At least I think so, I can't access the site at the moment...)
Matt
More information about the Python-list
mailing list