[Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal() (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Sat Oct 1 16:14:51 CEST 2011
- Previous message: [Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal()
- Next message: [Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
the subject says it all. PyUnicodeEncodeDecimal() is listed among the deprecated functions.
Please see the section on deprecation. None of the deprecated functions will be removed for a period of five years, and afterwards, they will be kept until usage outside of the core is low. Most likely, this means they will be kept until Python 4.
* It is not trivial to implement.
* With the Unicode implementation constantly changing, it is nearly impossible to know what input is currently regarded as a decimal digit. See also:
I still recommend that you come up with your own implementation of that algorithm. You probably don't need any of the error handler support, which makes the largest portion of the code. Then, use Py_UNICODE_TODECIMAL to process individual characters. It's a simple loop over every character.
In addition, you could also take the same approach as decimal.py, i.e. do
self._int = str(int(intpart+fracpart))
This would improve compatibility with the decimal.py implementation, which doesn't use PyUnicode_EncodeDecimal either (but instead goes through _PyUnicode_TransformDecimalAndSpaceToASCII).
Regards, Martin
- Previous message: [Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal()
- Next message: [Python-Dev] PEP-393: request for keeping PyUnicode_EncodeDecimal()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]