mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
iter type: Added __doc__
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user