ANN: mxNumber -- Experimental Number Types, Version 0.2.0

Steve Holden sholden at holdenweb.com
Fri Apr 27 15:39:13 EDT 2001


"Brian Kelley" <kelley at bioreason.com> wrote in message
news:3AE9C0E2.64A87C9A at bioreason.com...
> I have taken the opportunity to expose a couple of Integer methods
>
> Integer.popcount() - number of bits set
> Integer.setbit(bit) - set the bit indicated by bit
> Integer.clrbit(bit) - set the bit indicated by bit
>
> These are very useful for Aritificial Intelligence/feature vector
algorithms.  Is
> there any other desire to see these types of functions exposed?  I would
be happy to
> send a patch although it's only 3 minutes of work to do...
>
> The other question I have is about pickling:  I noticed that the pickled
structures
> use a string to determine the "long" representation.  This is somewhat
wasteful for
> storage considerations.  Is there any chance for a compressed version of
the long
> representation?  I would be more than happy to look into this, I just
don't know if
> it is feasible.
>
>From 2.0 library reference manual, section 3.11:

"""
A binary format, which is slightly more efficient, can be chosen by
specifying a nonzero (true) value for the bin argument to the Pickler
constructor or the dump() and dumps() functions. The binary format is not
the default because of backwards compatibility with the Python 1.4 pickle
module. In a future version, the default may change to binary.
"""

For speed you should use cPickle unless you need to subclass the picklers -
it reportedly runs much faster.

regards
 StEvE




More information about the Python-list mailing list