Changeset 391 for python/trunk/Doc/c-api/number.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/c-api/number.rst
r2 r391 7 7 8 8 9 .. c function:: int PyNumber_Check(PyObject *o)9 .. c:function:: int PyNumber_Check(PyObject *o) 10 10 11 11 Returns ``1`` if the object *o* provides numeric protocols, and false otherwise. … … 13 13 14 14 15 .. c function:: PyObject* PyNumber_Add(PyObject *o1, PyObject *o2)15 .. c:function:: PyObject* PyNumber_Add(PyObject *o1, PyObject *o2) 16 16 17 17 Returns the result of adding *o1* and *o2*, or *NULL* on failure. This is the … … 19 19 20 20 21 .. c function:: PyObject* PyNumber_Subtract(PyObject *o1, PyObject *o2)21 .. c:function:: PyObject* PyNumber_Subtract(PyObject *o1, PyObject *o2) 22 22 23 23 Returns the result of subtracting *o2* from *o1*, or *NULL* on failure. This is … … 25 25 26 26 27 .. c function:: PyObject* PyNumber_Multiply(PyObject *o1, PyObject *o2)27 .. c:function:: PyObject* PyNumber_Multiply(PyObject *o1, PyObject *o2) 28 28 29 29 Returns the result of multiplying *o1* and *o2*, or *NULL* on failure. This is … … 31 31 32 32 33 .. c function:: PyObject* PyNumber_Divide(PyObject *o1, PyObject *o2)33 .. c:function:: PyObject* PyNumber_Divide(PyObject *o1, PyObject *o2) 34 34 35 35 Returns the result of dividing *o1* by *o2*, or *NULL* on failure. This is the … … 37 37 38 38 39 .. c function:: PyObject* PyNumber_FloorDivide(PyObject *o1, PyObject *o2)39 .. c:function:: PyObject* PyNumber_FloorDivide(PyObject *o1, PyObject *o2) 40 40 41 41 Return the floor of *o1* divided by *o2*, or *NULL* on failure. This is … … 45 45 46 46 47 .. c function:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2)47 .. c:function:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2) 48 48 49 49 Return a reasonable approximation for the mathematical value of *o1* divided by … … 56 56 57 57 58 .. c function:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2)58 .. c:function:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2) 59 59 60 60 Returns the remainder of dividing *o1* by *o2*, or *NULL* on failure. This is … … 62 62 63 63 64 .. c function:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2)64 .. c:function:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2) 65 65 66 66 .. index:: builtin: divmod … … 70 70 71 71 72 .. c function:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3)72 .. c:function:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3) 73 73 74 74 .. index:: builtin: pow … … 76 76 See the built-in function :func:`pow`. Returns *NULL* on failure. This is the 77 77 equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is optional. 78 If *o3* is to be ignored, pass :c data:`Py_None` in its place (passing *NULL* for78 If *o3* is to be ignored, pass :c:data:`Py_None` in its place (passing *NULL* for 79 79 *o3* would cause an illegal memory access). 80 80 81 81 82 .. c function:: PyObject* PyNumber_Negative(PyObject *o)82 .. c:function:: PyObject* PyNumber_Negative(PyObject *o) 83 83 84 84 Returns the negation of *o* on success, or *NULL* on failure. This is the … … 86 86 87 87 88 .. c function:: PyObject* PyNumber_Positive(PyObject *o)88 .. c:function:: PyObject* PyNumber_Positive(PyObject *o) 89 89 90 90 Returns *o* on success, or *NULL* on failure. This is the equivalent of the … … 92 92 93 93 94 .. c function:: PyObject* PyNumber_Absolute(PyObject *o)94 .. c:function:: PyObject* PyNumber_Absolute(PyObject *o) 95 95 96 96 .. index:: builtin: abs … … 100 100 101 101 102 .. c function:: PyObject* PyNumber_Invert(PyObject *o)102 .. c:function:: PyObject* PyNumber_Invert(PyObject *o) 103 103 104 104 Returns the bitwise negation of *o* on success, or *NULL* on failure. This is … … 106 106 107 107 108 .. c function:: PyObject* PyNumber_Lshift(PyObject *o1, PyObject *o2)108 .. c:function:: PyObject* PyNumber_Lshift(PyObject *o1, PyObject *o2) 109 109 110 110 Returns the result of left shifting *o1* by *o2* on success, or *NULL* on … … 112 112 113 113 114 .. c function:: PyObject* PyNumber_Rshift(PyObject *o1, PyObject *o2)114 .. c:function:: PyObject* PyNumber_Rshift(PyObject *o1, PyObject *o2) 115 115 116 116 Returns the result of right shifting *o1* by *o2* on success, or *NULL* on … … 118 118 119 119 120 .. c function:: PyObject* PyNumber_And(PyObject *o1, PyObject *o2)120 .. c:function:: PyObject* PyNumber_And(PyObject *o1, PyObject *o2) 121 121 122 122 Returns the "bitwise and" of *o1* and *o2* on success and *NULL* on failure. … … 124 124 125 125 126 .. c function:: PyObject* PyNumber_Xor(PyObject *o1, PyObject *o2)126 .. c:function:: PyObject* PyNumber_Xor(PyObject *o1, PyObject *o2) 127 127 128 128 Returns the "bitwise exclusive or" of *o1* by *o2* on success, or *NULL* on … … 130 130 131 131 132 .. c function:: PyObject* PyNumber_Or(PyObject *o1, PyObject *o2)132 .. c:function:: PyObject* PyNumber_Or(PyObject *o1, PyObject *o2) 133 133 134 134 Returns the "bitwise or" of *o1* and *o2* on success, or *NULL* on failure. … … 136 136 137 137 138 .. c function:: PyObject* PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2)138 .. c:function:: PyObject* PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2) 139 139 140 140 Returns the result of adding *o1* and *o2*, or *NULL* on failure. The operation … … 143 143 144 144 145 .. c function:: PyObject* PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2)145 .. c:function:: PyObject* PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2) 146 146 147 147 Returns the result of subtracting *o2* from *o1*, or *NULL* on failure. The … … 150 150 151 151 152 .. c function:: PyObject* PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2)152 .. c:function:: PyObject* PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2) 153 153 154 154 Returns the result of multiplying *o1* and *o2*, or *NULL* on failure. The … … 157 157 158 158 159 .. c function:: PyObject* PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2)159 .. c:function:: PyObject* PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2) 160 160 161 161 Returns the result of dividing *o1* by *o2*, or *NULL* on failure. The … … 164 164 165 165 166 .. c function:: PyObject* PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2)166 .. c:function:: PyObject* PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2) 167 167 168 168 Returns the mathematical floor of dividing *o1* by *o2*, or *NULL* on failure. … … 173 173 174 174 175 .. c function:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2)175 .. c:function:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2) 176 176 177 177 Return a reasonable approximation for the mathematical value of *o1* divided by … … 184 184 185 185 186 .. c function:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2)186 .. c:function:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2) 187 187 188 188 Returns the remainder of dividing *o1* by *o2*, or *NULL* on failure. The … … 191 191 192 192 193 .. c function:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3)193 .. c:function:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3) 194 194 195 195 .. index:: builtin: pow … … 197 197 See the built-in function :func:`pow`. Returns *NULL* on failure. The operation 198 198 is done *in-place* when *o1* supports it. This is the equivalent of the Python 199 statement ``o1 **= o2`` when o3 is :c data:`Py_None`, or an in-place variant of200 ``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, pass :c data:`Py_None`199 statement ``o1 **= o2`` when o3 is :c:data:`Py_None`, or an in-place variant of 200 ``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, pass :c:data:`Py_None` 201 201 in its place (passing *NULL* for *o3* would cause an illegal memory access). 202 202 203 203 204 .. c function:: PyObject* PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2)204 .. c:function:: PyObject* PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2) 205 205 206 206 Returns the result of left shifting *o1* by *o2* on success, or *NULL* on … … 209 209 210 210 211 .. c function:: PyObject* PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2)211 .. c:function:: PyObject* PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2) 212 212 213 213 Returns the result of right shifting *o1* by *o2* on success, or *NULL* on … … 216 216 217 217 218 .. c function:: PyObject* PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2)218 .. c:function:: PyObject* PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2) 219 219 220 220 Returns the "bitwise and" of *o1* and *o2* on success and *NULL* on failure. The … … 223 223 224 224 225 .. c function:: PyObject* PyNumber_InPlaceXor(PyObject *o1, PyObject *o2)225 .. c:function:: PyObject* PyNumber_InPlaceXor(PyObject *o1, PyObject *o2) 226 226 227 227 Returns the "bitwise exclusive or" of *o1* by *o2* on success, or *NULL* on … … 230 230 231 231 232 .. c function:: PyObject* PyNumber_InPlaceOr(PyObject *o1, PyObject *o2)232 .. c:function:: PyObject* PyNumber_InPlaceOr(PyObject *o1, PyObject *o2) 233 233 234 234 Returns the "bitwise or" of *o1* and *o2* on success, or *NULL* on failure. The … … 237 237 238 238 239 .. c function:: int PyNumber_Coerce(PyObject **p1, PyObject **p2)239 .. c:function:: int PyNumber_Coerce(PyObject **p1, PyObject **p2) 240 240 241 241 .. index:: builtin: coerce 242 242 243 This function takes the addresses of two variables of type :c type:`PyObject\*`.243 This function takes the addresses of two variables of type :c:type:`PyObject\*`. 244 244 If the objects pointed to by ``*p1`` and ``*p2`` have the same type, increment 245 245 their reference count and return ``0`` (success). If the objects can be … … 251 251 252 252 253 .. c function:: int PyNumber_CoerceEx(PyObject **p1, PyObject **p2)254 255 This function is similar to :c func:`PyNumber_Coerce`, except that it returns253 .. c:function:: int PyNumber_CoerceEx(PyObject **p1, PyObject **p2) 254 255 This function is similar to :c:func:`PyNumber_Coerce`, except that it returns 256 256 ``1`` when the conversion is not possible and when no error is raised. 257 257 Reference counts are still not increased in this case. 258 258 259 259 260 .. c function:: PyObject* PyNumber_Int(PyObject *o)260 .. c:function:: PyObject* PyNumber_Int(PyObject *o) 261 261 262 262 .. index:: builtin: int … … 267 267 268 268 269 .. c function:: PyObject* PyNumber_Long(PyObject *o)269 .. c:function:: PyObject* PyNumber_Long(PyObject *o) 270 270 271 271 .. index:: builtin: long … … 275 275 276 276 277 .. c function:: PyObject* PyNumber_Float(PyObject *o)277 .. c:function:: PyObject* PyNumber_Float(PyObject *o) 278 278 279 279 .. index:: builtin: float … … 283 283 284 284 285 .. c function:: PyObject* PyNumber_Index(PyObject *o)285 .. c:function:: PyObject* PyNumber_Index(PyObject *o) 286 286 287 287 Returns the *o* converted to a Python int or long on success or *NULL* with a … … 291 291 292 292 293 .. c function:: PyObject* PyNumber_ToBase(PyObject *n, int base)293 .. c:function:: PyObject* PyNumber_ToBase(PyObject *n, int base) 294 294 295 295 Returns the integer *n* converted to *base* as a string with a base … … 297 297 *base* is not 2, 8, 10, or 16, the format is ``'x#num'`` where x is the 298 298 base. If *n* is not an int object, it is converted with 299 :c func:`PyNumber_Index` first.299 :c:func:`PyNumber_Index` first. 300 300 301 301 .. versionadded:: 2.6 302 302 303 303 304 .. c function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc)304 .. c:function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) 305 305 306 306 Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an … … 315 315 316 316 317 .. c function:: int PyIndex_Check(PyObject *o)317 .. c:function:: int PyIndex_Check(PyObject *o) 318 318 319 319 Returns True if *o* is an index integer (has the nb_index slot of the
Note:
See TracChangeset
for help on using the changeset viewer.