[Python-Dev] Base-n integer formatting
Yuri Vilmanis
vilmanis at internode.on.net
Wed Sep 10 23:09:29 EDT 2003
I have three feature requests for you: no. 1 is quite fundamental, no. 2 would
be a 'nice' useful feature and no. 3 is a bit more esoteric, but very useful
in certain applications
1) print formatting for integers is currently only available for octal, hex,
and decimal. This seems rather odd, as string to integer conversion is
available for bases 2 through 36. End result: when I want to do things in
base 6 (rare, but it has happened twice) or much more commonly in binary, I
can read the numbers in, but cannot print the results - ie quite useless.
2) Input and output formatting for unary (which is commonly referred to as
base 1, yes, I know it's not 'really' base 1 by the general deinition of
base, but "base 1" is the convention) would also be good, as would roman
numeral support, especially in word-processing applications or IO from any
formatted document with roman page/section numbers
3) negative bases: I have needed this more times than I think some people
would care to imagine. These representations have several very useful
properties such as implementation-independent signdness (hence arbirtrary
word length), and some more interesting properties I won't expand on here.
Context: I find python very handy not only as a programming/scripting language
but also as a scratchpad for various number theory investigations.
Unfortunately the output formatting leaves all but the most basic
investigations out in the cold, and lack of negative base input/output makes
it harder to use python to look for certain patterns in result sets, not to
mention getting the data in...
Thanks,
Yuri
More information about the Python-Dev
mailing list