On Sun, Aug 30, 2009 at 9:55 PM, Carl Johnson <cmjohnson.mailinglist@gmail.com> wrote:
Doing some testing with int, I found:

ValueError: int() base must be >= 2 and <= 36

That resolves a lot of questions (it has to be case insensitive), but
takes away ability to do the motivating use case: writing out video
ids in Base-62.

If there are widely accepted and used non-controversial standard character -> digit mappings for bases greater than that I don't immediately see any reasons not to support them for ints but I do not think we should go beyond base 255.

If someone wants base 256 they should use struct.pack() and beyond that I expect to find people fighting over encoding schemes. ;)

Since this is the ideas list...  Consider adding a digit character sequence or map passed to the conversion function defining which characters map to which digit number.

 

—Carl

On Sun, Aug 30, 2009 at 6:49 PM, Carl
Johnson<cmjohnson.mailinglist@gmail.com> wrote:
> How would it work for bases beyond 10? OK, so base-16 has a well known
> encoding, but what about base-100? Base-16 is case insensitive, but
> would Base-37 be case insensitive?…
>
> ISTM that the common encodings of bin, oct, and hex are already
> covered by built-in functions and for bases beyond that, you have
> decide what system to use for encoding symbols that are out of range.
> Do people really need trinary through septary that often? Is there a
> single, best-practices way of doing base-1013? Feels like YAGNI to me,
> but I could be wrong.
>
> — Carl Johnson
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas