Underscores in Python numbers

Steve Holden steve at holdenweb.com
Sat Nov 19 10:53:45 EST 2005


bonono at gmail.com wrote:
> Stefan Rank wrote:
> 
>>The other idea of teaching int() about separator characters has
>>internationalis/zation issues:
>>In many European countries, one would naturally try::
>>
>>   int('500.000,23')
>>
>>instead of::
>>
>>   int('500,000.23')
> 
> 
> That is why I said
> 
> "Of course, also support the locale variant where the meaning of ","
> and
> "." is swapped in most European countries. "
> 
> We are seeing the same about base 2, 8, 10, 16.
> 
> May be :
> 
> int("E500.000,23")
> 
> as we are using :
> 
> 0xffff 
> 
> already for hex number
> 
I really wouldn't want it to become possible to write Python code in one 
locale that had to be edited before the numeric literals were valid in 
another locale. That way madness lies.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list