[Python-ideas] PEP 3101 (Advanced string formatting) base 36 integer presentation type
Antoine Pitrou
solipsis at pitrou.net
Sat Oct 8 17:53:12 CEST 2011
On Sat, 08 Oct 2011 08:44:52 -0700
Ethan Furman <ethan at stoneleaf.us> wrote:
> Antoine Pitrou wrote:
> > On Fri, 07 Oct 2011 21:14:44 -0600
> > Jeffrey <jss.bulk at gmail.com> wrote:
> >> I would like to suggest adding an integer presentation type for base 36
> >> to PEP 3101. I can't imagine that it would be a whole lot more
> >> difficult than the existing types. Python's built-in long integers
> >> provide a nice way to prototype and demonstrate cryptographic
> >> operations, especially with asymmetric cryptography. (Alice and Bob
> >> stuff.) Built-in functions provide modular reduction, modular
> >> exponentiation, and lots of nice number theory stuff that supports a
> >> variety of protocols and algorithms. A frequent need is to represent a
> >> message by a number. Base 36 provides a way to represent all 26 letters
> >> in a semi-standard way, and simple string transformations can
> >> efficiently make zeros into spaces or vice versa.
> >
> > Why base 36 rather than, say, base 64 or even base 80?
>
> Because there are 26 ascii letters and 10 ascii digits?
That's not really answering the question. Are people used to reading
and manipulating numbers in base 36? If not, why not use the most
compact representation?
(if you are not interested in the most compact representation, then you
can simply use base 10 or 16)
Regards
Antoine.
More information about the Python-ideas
mailing list