<br><div class="gmail_quote">On Sun, Aug 30, 2009 at 9:55 PM, Carl Johnson <span dir="ltr"><<a href="mailto:cmjohnson.mailinglist@gmail.com">cmjohnson.mailinglist@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Doing some testing with int, I found:<br>
<br>
ValueError: int() base must be >= 2 and <= 36<br>
<br>
That resolves a lot of questions (it has to be case insensitive), but<br>
takes away ability to do the motivating use case: writing out video<br>
ids in Base-62.<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>If someone wants base 256 they should use struct.pack() and beyond that I expect to find people fighting over encoding schemes. ;)</div><div><br></div><div>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.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
—Carl<br>
</font><div><div></div><div class="h5"><br>
On Sun, Aug 30, 2009 at 6:49 PM, Carl<br>
Johnson<<a href="mailto:cmjohnson.mailinglist@gmail.com">cmjohnson.mailinglist@gmail.com</a>> wrote:<br>
> How would it work for bases beyond 10? OK, so base-16 has a well known<br>
> encoding, but what about base-100? Base-16 is case insensitive, but<br>
> would Base-37 be case insensitive?…<br>
><br>
> ISTM that the common encodings of bin, oct, and hex are already<br>
> covered by built-in functions and for bases beyond that, you have<br>
> decide what system to use for encoding symbols that are out of range.<br>
> Do people really need trinary through septary that often? Is there a<br>
> single, best-practices way of doing base-1013? Feels like YAGNI to me,<br>
> but I could be wrong.<br>
><br>
> — Carl Johnson<br>
><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br>