Underscores in Python numbers

bonono at gmail.com bonono at gmail.com
Sat Nov 19 15:02:16 EST 2005


Steve Holden wrote:
> 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.
That is the fact, from the very beginning. 1.234 striaightly speaking
can have different meaning,. So if you don't want, don't support it and
always use the non-European notation.




More information about the Python-list mailing list