We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
array.array.__contains__
1 parent 62aa942 commit 0527c4eCopy full SHA for 0527c4e
stdlib/src/array.rs
@@ -1160,6 +1160,23 @@ mod array {
1160
zelf.as_object().dict(),
1161
))
1162
}
1163
+
1164
+ #[pymethod(magic)]
1165
+ fn contains(&self, value: PyObjectRef, vm: &VirtualMachine) -> bool {
1166
+ let array = self.array.read();
1167
+ for element in array
1168
+ .iter(vm)
1169
+ .map(|x| x.expect("Expected to be checked by array.len() and read lock."))
1170
+ {
1171
+ if let Ok(true) =
1172
+ element.rich_compare_bool(value.as_object(), PyComparisonOp::Eq, vm)
1173
1174
+ return true;
1175
+ }
1176
1177
1178
+ false
1179
1180
1181
1182
impl Comparable for PyArray {
0 commit comments