Add documentation for a pymethod in map.rs

Signed-off-by: Tony Jinwoo Ahn <tony.jinwoo.ahn@gmail.com>
This commit is contained in:
Tony Jinwoo Ahn
2021-09-01 23:38:00 +09:00
parent 8473ea9911
commit c211402a76

View File

@@ -8,7 +8,7 @@ use crate::{PyClassImpl, PyContext, PyObjectRef, PyRef, PyResult, PyValue};
/// map(func, *iterables) --> map object
///
/// Make an iterator that computes the function using arguments from
/// each of the iterables. Stops when the shortest iterable is exhausted.
/// each of the iterables. Stops when the shortest iterable is exhausted.
#[pyclass(module = false, name = "map")]
#[derive(Debug)]
pub struct PyMap {
@@ -42,6 +42,7 @@ impl PyMap {
.into_ref_with_type(vm, cls)
}
/// Return an estimate of the number of items.
#[pymethod(magic)]
fn length_hint(&self, vm: &VirtualMachine) -> PyResult<usize> {
self.iterators.iter().try_fold(0, |prev, cur| {