We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b289aa5 commit 09a10aaCopy full SHA for 09a10aa
vm/src/builtins/map.rs
@@ -1,5 +1,6 @@
1
use super::PyTypeRef;
2
use crate::{
3
+ builtins::PyTupleRef,
4
class::PyClassImpl,
5
function::PosArgs,
6
protocol::{PyIter, PyIterReturn},
@@ -45,6 +46,13 @@ impl PyMap {
45
46
Ok(max)
47
})
48
}
49
+
50
+ #[pymethod(magic)]
51
+ fn reduce(&self, vm: &VirtualMachine) -> (PyTypeRef, PyTupleRef) {
52
+ let mut vec = vec![self.mapper.clone()];
53
+ vec.extend(self.iterators.iter().map(|o| o.clone().into()));
54
+ (vm.ctx.types.map_type.clone(), vm.new_tuple(vec))
55
+ }
56
57
58
impl IterNextIterable for PyMap {}
0 commit comments