diff --git a/vm/src/obj/objiter.rs b/vm/src/obj/objiter.rs index 7d4507212..a14a4d51e 100644 --- a/vm/src/obj/objiter.rs +++ b/vm/src/obj/objiter.rs @@ -161,6 +161,13 @@ fn iter_next(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult { pub fn init(context: &PyContext) { let iter_type = &context.iter_type; + + let iter_doc = "iter(iterable) -> iterator\n\ + iter(callable, sentinel) -> iterator\n\n\ + Get an iterator from an object. In the first form, the argument must\n\ + supply its own iterator, or be a sequence.\n\ + In the second form, the callable is called until it returns the sentinel."; + context.set_attr( &iter_type, "__contains__", @@ -169,4 +176,5 @@ pub fn init(context: &PyContext) { context.set_attr(&iter_type, "__iter__", context.new_rustfunc(iter_iter)); context.set_attr(&iter_type, "__new__", context.new_rustfunc(iter_new)); context.set_attr(&iter_type, "__next__", context.new_rustfunc(iter_next)); + context.set_attr(&iter_type, "__doc__", context.new_str(iter_doc.to_string())); }