Underscores in Python numbers

Roy Smith roy at panix.com
Sat Nov 19 10:34:52 EST 2005


bearophileHUGS at lycos.com wrote:
> Alternatively the underscore syntax may be used to separate the number
> from its base:
> 22875 == 22875_10 == 595b_16 == 123456_7
> But probably this is less commonly useful (and not much explicit).

We already have a perfectly good syntax for entering octal and hex 
integers, because those are commonly used in many applications.  There are, 
on occasion, need for other bases, but they are so rare, specialized, and 
non-standard (RFC-1924, for example, uses an interesting flavor of base-85) 
that having syntax built into the language to support them would be 
completely unjustified.



More information about the Python-list mailing list