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

Lie Ryan lie.1296 at gmail.com
Mon Sep 14 14:36:43 CEST 2009


Yuvgoog Greenle wrote:
> Btw, when you say translation table, do you mean just a string? Because 
> a translation table would need to be continuous from 0 to the base so a 
> real dicitionary-esque table may be overkill. The only advantage of a 
> table might be to convert certain digits into multiple bytes (some sort 
> of ad-hoc unicode use case?).
> 

If the translation table is limited to a string, the function would be 
very limited. For example, it might be useful to use base-change 
function to convert between an IPv4 address and integer. The common 
representation of IPv4 address uses base-255 "number" 
(0.0.0.0-255.255.255.255)




More information about the Python-ideas mailing list