Binary in-place operators The in-place operators are defined to fall back to the 'normal', non in-place operations, if the in-place methods are not in place. - If the left hand object has the appropriate struct members, and they are filled, call the appropriate function and return the result. No coercion is done on the arguments; the left-hand object is the one the operation is performed on, an
(
&self,
a: &PyObject,
b: &PyObject,
iop_slot: PyNumberBinaryOp,
op_slot: PyNumberBinaryOp,
)
| 259 | /// - Otherwise, in-place modification is not supported. Handle it exactly as |
| 260 | /// a non in-place operation of the same kind. |
| 261 | fn binary_iop1( |
| 262 | &self, |
| 263 | a: &PyObject, |
| 264 | b: &PyObject, |
| 265 | iop_slot: PyNumberBinaryOp, |
| 266 | op_slot: PyNumberBinaryOp, |
| 267 | ) -> PyResult { |
| 268 | if let Some(slot) = a.class().slots.as_number.left_binary_op(iop_slot) { |
| 269 | let x = slot(a, b, self)?; |
| 270 | if !x.is(&self.ctx.not_implemented) { |
| 271 | return Ok(x); |
| 272 | } |
| 273 | } |
| 274 | self.binary_op1(a, b, op_slot) |
| 275 | } |
| 276 | |
| 277 | fn binary_iop( |
| 278 | &self, |
no test coverage detected