On 28/11/2010 23:59, "Martin v. Löwis" wrote:
FWIW the C# equivalent is locale aware *unless* you pass in a specific culture. (System.Double.Parse):
That's not quite the equivalent of float(), I would say: this one apparently is locale-aware, so it is more the equivalent of locale.atof.
Right. It is *the* standard way of getting a float from a string though, whereas in Python we have two depending on whether or not you want to be locale aware. The standard way in C# is locale aware. To be non-locale aware you pass in a specific culture or number format.
The next question then is if it supports indo-arabic digits in any locale (or more specifically in an arabic locale).
I don't think so actually. The float parse formatting rules are defined like this:
integral-digits, fractional-digits and exponential-digits are all defined as "A series of digits ranging from 0 to 9". Arguably this is not be conclusive. In fact the NumberFormatInfo class seems to hint that it may be otherwise:
See DigitSubstitution on that page. I would have to try it to be sure and I don't have a Windows VM in convenient reach right now.
All the best,