I am using the Python decimal module, I’ve set my locale to Germany such that locale.localeconv()["decimal_point"] is ",". When I try creating a decimal like decimal.Decimal("1,23"), I get a decimal conversion syntax error. When I do decimal.Decimal("1.23"), it works.
Does the Python decimal not respect locale settings when creating decimal from string?
>Solution :
No, the decimal.Decimal constructor only accepts numeric strings according to the grammar shown, where . is the only decimal point supported.
decimal-part ::= digits '.' [digits] | ['.'] digits
The locale settings are only relevant for formatting a Decimal back to a string, see e.g. How can I locale-format a python Decimal and preserve its precision?