ANN: mxNumber -- Experimental Number Types, Version 0.2.0
Tim Peters
tim.one at home.com
Fri Apr 27 15:43:06 EDT 2001
[Brian Kelley]
> 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?
Yes, provided they're carefully defined. For example, what's the popcount
of -1? If you're viewing Integers as using 2's-comp notation (as Python
does), there's no obvious answer to that (-1 is an "infinite string" of 1
bits), which makes it *especially* important to define what it does. All
previous attempts to define these kinds of things floundered to death in an
ocean of competing silly arguments.
> ...
> 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?
Pickles are supposed to be platform- and release-independent, so you can't
change what the existing long format code does. Note that it's "a feature"
of text-mode pickles that they're composed of printable ASCII, too. It's
possible that you may be able to add a new format code to binary pickles.
More information about the Python-list
mailing list