[Python-ideas] Add a builtin method to 'int' for base/radix conversion

Yuvgoog Greenle ubershmekel at gmail.com
Thu Sep 17 03:12:59 CEST 2009


Excuse my 'obviously', let me clarify.
The following alphabet is reversable:
for encode: {0 : 'a', 1, 'b'}
for encode/decode: {0: 'a', 1: 'b', 'a':0, 'b':1}

You can have 'a' and 'A' coexist, but the encode will have only one option.
for encode: :{0 : 'a', 1, 'b'}
for encode/decode: {0: 'a', 1: 'b', 'a': 0, 'b': 1, 'A': 0, 'B': 1}

So one could say the encoding alphabet is the canonical representation. The
encoding alphabet is actually alphabet_dict[0],..., alphabet_dict[base - 1].

On Wed, Sep 16, 2009 at 10:34 AM, Arnaud Delobelle
<arnodel at googlemail.com>wrote:

> 2009/9/16 Yuvgoog Greenle <ubershmekel at gmail.com>:
> [...]
> > The only problem with {'A': 10, 'a': 10} is that it's not reversible. If
> we
> > wantted to encode, 10, what should be used, A or a?
>
> Obviously, either  :)
>
> --
> Arnaud
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090917/dab26385/attachment.html>


More information about the Python-ideas mailing list