diff options
author | Eric Smith <eric@trueblade.com> | 2009-04-25 21:40:15 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2009-04-25 21:40:15 (GMT) |
commit | 068f06568be288b8628a4e24118503e4d9b7af1b (patch) | |
tree | e1d01c08ed08489c994e7cbf167fd703c7f2c64e /Doc/c-api | |
parent | dfcffd40447de8e04376f8946fb71a9c16151563 (diff) | |
download | cpython-068f06568be288b8628a4e24118503e4d9b7af1b.zip cpython-068f06568be288b8628a4e24118503e4d9b7af1b.tar.gz cpython-068f06568be288b8628a4e24118503e4d9b7af1b.tar.bz2 |
Issue #5835, deprecate PyOS_ascii_formatd.
If anyone wants to clean up the documentation, feel free. It's my first documentation foray, and it's not that great.
Will port to py3k with a different strategy.
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/conversion.rst | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Doc/c-api/conversion.rst b/Doc/c-api/conversion.rst index 0c81bc0..e391b76 100644 --- a/Doc/c-api/conversion.rst +++ b/Doc/c-api/conversion.rst @@ -76,7 +76,42 @@ The following functions provide locale-independent string to number conversions. the conversion failed. .. versionadded:: 2.4 + .. deprecated:: 2.7 + This function is removed in Python 2.7 and 3.1. Use :func:`PyOS_double_to_string` + instead. +.. cfunction:: char * PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype) + + Convert a :ctype:`double` *val* to a string using supplied + *format_code*, *precision*, and *flags*. + + *format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``, + ``'g'``, ``'G'``, ``'s'``, or ``'r'``. For ``'s'`` and ``'r'``, the + supplied *precision* must be 0 and is ignored. These specify the + standards :func:`str` and :func:`repr` formats, respectively. + + *flags* can be zero or more of the values *Py_DTSF_SIGN*, + *Py_DTSF_ADD_DOT_0*, or *Py_DTSF_ALT*, and-ed together. + + *Py_DTSF_SIGN* means always precede the returned string with a + sign character, even if *val* is non-negative. + + *Py_DTSF_ADD_DOT_0* means ensure that the returned string will + not look like an integer. + + *Py_DTSF_ALT* means apply "alternate" formatting rules. See the + documentation for the :func:`PyOS_snprintf` ``'#'`` specifier + for details. + + If *ptype* is non-NULL, then the value it points to will be set to + one of *Py_DTST_FINITE*, *Py_DTST_INFINITE*, or *Py_DTST_NAN*, + signifying that *val* is a finite number, an infinite number, or + not a number, respectively. + + The return value is a pointer to *buffer* with the converted string or NULL if + the conversion failed. + + .. versionadded:: 2.7 .. cfunction:: double PyOS_ascii_atof(const char *nptr) |