| 1066 | } |
| 1067 | |
| 1068 | fn __iadd__( |
| 1069 | zelf: PyRef<Self>, |
| 1070 | other: PyObjectRef, |
| 1071 | vm: &VirtualMachine, |
| 1072 | ) -> PyResult<PyRef<Self>> { |
| 1073 | if zelf.is(&other) { |
| 1074 | zelf.try_resizable(vm)?.imul(2, vm)?; |
| 1075 | } else if let Some(other) = other.downcast_ref::<Self>() { |
| 1076 | zelf.try_resizable(vm)?.iadd(&other.read(), vm)?; |
| 1077 | } else { |
| 1078 | return Err(vm.new_type_error(format!( |
| 1079 | "can only extend array with array (not \"{}\")", |
| 1080 | other.class().name() |
| 1081 | ))); |
| 1082 | } |
| 1083 | Ok(zelf) |
| 1084 | } |
| 1085 | |
| 1086 | fn __mul__(&self, value: isize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> { |
| 1087 | self.read() |