On 03/12/2011 00:12, T.B. wrote:
I will start by stating that it's not my original idea, but taken from Erlang. See Erlang's io:format documentation here: http://www.erlang.org/doc/man/io.html#format-1 and notice the 'B' control sequence.
I would like to have an easy built-in way to print integers in different bases (radices). There are so many half baked solutions out there: http://bugs.python.org/issue6783 http://stackoverflow.com/questions/2267362/convert-integer-to-a-string-in-a-... http://stackoverflow.com/questions/2063425/python-elegant-inverse-function-o... http://code.activestate.com/recipes/65212/
I suggest using the precision field in the format specification for integers for that. [snip]
I think that the precision field should be used only for the precision and that sometimes using it for something completely different is a bad idea.