mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
implement reduce method to PySlice
Signed-off-by: yyun-d <yeo1998@naver.com>
This commit is contained in:
@@ -194,6 +194,20 @@ impl PySlice {
|
||||
let (start, stop, step) = self.inner_indices(length, vm)?;
|
||||
Ok(vm.new_tuple((start, stop, step)))
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
#[pymethod(magic)]
|
||||
fn reduce(
|
||||
zelf: PyRef<Self>,
|
||||
) -> PyResult<(
|
||||
PyTypeRef,
|
||||
(Option<PyObjectRef>, PyObjectRef, Option<PyObjectRef>),
|
||||
)> {
|
||||
Ok((
|
||||
zelf.clone_class(),
|
||||
(zelf.start.clone(), zelf.stop.clone(), zelf.step.clone()),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl Comparable for PySlice {
|
||||
|
||||
Reference in New Issue
Block a user