[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