[Python-Dev] %b format?

M.-A. Lemburg mal@lemburg.com
Wed, 30 May 2001 23:31:06 +0200


"Eric S. Raymond" wrote:
> 
> Greg Wilson <Greg.Wilson@baltimore.com>:
> > I would like to add a "%b" format for converting
> > numbers to binary format (1's and 0's).  I realize
> > this isn't a C-ism, but it would be very useful for
> > teaching purposes, as newcomers find 101101 a lot
> > easier to understand than 0x2D.
> >
> > Reactions?
> 
> +1.  Didactically pretty useful, and the additional code won't boost
> global complexity much.

Good idea. The only question I have is: in which order will
you print the 0s and 1s (MSB->LSB, LSB->MSB, little/big endian) ?

I am thinking of adding a bit field type to mxNumber and have
the same problem there...

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/