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:

[ws][$][sign][integral-digits[,]]integral-digits[.[fractional-digits]][E[sign]exponential-digits][ws]

(From http://msdn.microsoft.com/en-us/library/7yd1h1be.aspx )

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:

http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.aspx

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,

Michael

Regards,
Martin


--

http://www.voidspace.org.uk/

READ CAREFULLY. By accepting and reading this email you agree,
on behalf of your employer, to release me from all obligations
and waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to