I know the methods to convert a decimal number to binary, for example bin(10) or format(10, "#b") which outputs '0b1010'. (references: Python int to binary string?, Convert base-2 binary number string to int)
My question is wheter it is possible to set the formatting of all numbers in a python shell session to binary representation. That is, starting a session using python from the command line. Then, when writing numbers and executing the line I would like to see the numbers in their binary representation, like this:
>>> 10
0b1010
>>> 42
0b101010
Note that the results are numerical values and not str type as returned from bin() and format().