comparison Objects/floatobject.c @ 85977:ca8e75190402 2.7

#19069: use imperative mood in float object docstrings. Patch by Marco Buttu.
author Ezio Melotti <ezio.melotti@gmail.com>
date Sun, 06 Oct 2013 00:44:32 +0300
parents ff300ccd119d
children
comparison
equal deleted inserted replaced
85976:3ef157674abc 85977:ca8e75190402
1781 } 1781 }
1782 1782
1783 PyDoc_STRVAR(float_as_integer_ratio_doc, 1783 PyDoc_STRVAR(float_as_integer_ratio_doc,
1784 "float.as_integer_ratio() -> (int, int)\n" 1784 "float.as_integer_ratio() -> (int, int)\n"
1785 "\n" 1785 "\n"
1786 "Returns a pair of integers, whose ratio is exactly equal to the original\n" 1786 "Return a pair of integers, whose ratio is exactly equal to the original\n"
1787 "float and with a positive denominator.\n" 1787 "float and with a positive denominator.\n"
1788 "Raises OverflowError on infinities and a ValueError on NaNs.\n" 1788 "Raise OverflowError on infinities and a ValueError on NaNs.\n"
1789 "\n" 1789 "\n"
1790 ">>> (10.0).as_integer_ratio()\n" 1790 ">>> (10.0).as_integer_ratio()\n"
1791 "(10, 1)\n" 1791 "(10, 1)\n"
1792 ">>> (0.0).as_integer_ratio()\n" 1792 ">>> (0.0).as_integer_ratio()\n"
1793 "(0, 1)\n" 1793 "(0, 1)\n"
1968 "\n" 1968 "\n"
1969 "typestr must be 'double' or 'float'. fmt must be one of 'unknown',\n" 1969 "typestr must be 'double' or 'float'. fmt must be one of 'unknown',\n"
1970 "'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be\n" 1970 "'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be\n"
1971 "one of the latter two if it appears to match the underlying C reality.\n" 1971 "one of the latter two if it appears to match the underlying C reality.\n"
1972 "\n" 1972 "\n"
1973 "Overrides the automatic determination of C-level floating point type.\n" 1973 "Override the automatic determination of C-level floating point type.\n"
1974 "This affects how floats are converted to and from binary strings."); 1974 "This affects how floats are converted to and from binary strings.");
1975 1975
1976 static PyObject * 1976 static PyObject *
1977 float_getzero(PyObject *v, void *closure) 1977 float_getzero(PyObject *v, void *closure)
1978 { 1978 {
2015 "Formats the float according to format_spec."); 2015 "Formats the float according to format_spec.");
2016 2016
2017 2017
2018 static PyMethodDef float_methods[] = { 2018 static PyMethodDef float_methods[] = {
2019 {"conjugate", (PyCFunction)float_float, METH_NOARGS, 2019 {"conjugate", (PyCFunction)float_float, METH_NOARGS,
2020 "Returns self, the complex conjugate of any float."}, 2020 "Return self, the complex conjugate of any float."},
2021 {"__trunc__", (PyCFunction)float_trunc, METH_NOARGS, 2021 {"__trunc__", (PyCFunction)float_trunc, METH_NOARGS,
2022 "Returns the Integral closest to x between 0 and x."}, 2022 "Return the Integral closest to x between 0 and x."},
2023 {"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS, 2023 {"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS,
2024 float_as_integer_ratio_doc}, 2024 float_as_integer_ratio_doc},
2025 {"fromhex", (PyCFunction)float_fromhex, 2025 {"fromhex", (PyCFunction)float_fromhex,
2026 METH_O|METH_CLASS, float_fromhex_doc}, 2026 METH_O|METH_CLASS, float_fromhex_doc},
2027 {"hex", (PyCFunction)float_hex, 2027 {"hex", (PyCFunction)float_hex,
2028 METH_NOARGS, float_hex_doc}, 2028 METH_NOARGS, float_hex_doc},
2029 {"is_integer", (PyCFunction)float_is_integer, METH_NOARGS, 2029 {"is_integer", (PyCFunction)float_is_integer, METH_NOARGS,
2030 "Returns True if the float is an integer."}, 2030 "Return True if the float is an integer."},
2031 #if 0 2031 #if 0
2032 {"is_inf", (PyCFunction)float_is_inf, METH_NOARGS, 2032 {"is_inf", (PyCFunction)float_is_inf, METH_NOARGS,
2033 "Returns True if the float is positive or negative infinite."}, 2033 "Return True if the float is positive or negative infinite."},
2034 {"is_finite", (PyCFunction)float_is_finite, METH_NOARGS, 2034 {"is_finite", (PyCFunction)float_is_finite, METH_NOARGS,
2035 "Returns True if the float is finite, neither infinite nor NaN."}, 2035 "Return True if the float is finite, neither infinite nor NaN."},
2036 {"is_nan", (PyCFunction)float_is_nan, METH_NOARGS, 2036 {"is_nan", (PyCFunction)float_is_nan, METH_NOARGS,
2037 "Returns True if the float is not a number (NaN)."}, 2037 "Return True if the float is not a number (NaN)."},
2038 #endif 2038 #endif
2039 {"__getnewargs__", (PyCFunction)float_getnewargs, METH_NOARGS}, 2039 {"__getnewargs__", (PyCFunction)float_getnewargs, METH_NOARGS},
2040 {"__getformat__", (PyCFunction)float_getformat, 2040 {"__getformat__", (PyCFunction)float_getformat,
2041 METH_O|METH_CLASS, float_getformat_doc}, 2041 METH_O|METH_CLASS, float_getformat_doc},
2042 {"__setformat__", (PyCFunction)float_setformat, 2042 {"__setformat__", (PyCFunction)float_setformat,