A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-May/015118.html below:

[Python-Dev] %b format?

[Python-Dev] %b format?Tim Peters tim.one@home.com
Wed, 30 May 2001 17:50:31 -0400
[Greg Wilson]
> I would like to add a "%b" format for converting
> numbers to binary format (1's and 0's).

-0, due to compound lumpiness:  hex() is to %x is to __hex__ as oct() is to
%o is to __oct__ as nothing is to %b is to nothing.  In that respect it's
unfortunate that Python has distinct nb_oct and nb_hex slots in the
PyNumberMethods struct (as opposed to a single parameterized "convert to
base N string" method).

[MAL]
> 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'm sure Greg has in mind only integers, in which case %x and %o already
give the only useful <wink> answer.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4