mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
When I run list[()], I modify it so that list[()] comes out
This commit is contained in:
@@ -98,17 +98,26 @@ impl PyGenericAlias {
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
Ok(format!(
|
||||
"{}[{}]",
|
||||
repr_item(self.origin.as_object().to_owned(), vm)?,
|
||||
self.args
|
||||
.as_slice()
|
||||
.iter()
|
||||
.map(|o| repr_item(o.clone(), vm))
|
||||
.collect::<PyResult<Vec<_>>>()?
|
||||
.join(", ")
|
||||
))
|
||||
|
||||
if self.args.len() == 0 {
|
||||
Ok(format!(
|
||||
"{}[{}]",
|
||||
repr_item(self.origin.as_object().to_owned(), vm)?,
|
||||
"()"
|
||||
))
|
||||
}
|
||||
else {
|
||||
Ok(format!(
|
||||
"{}[{}]",
|
||||
repr_item(self.origin.as_object().to_owned(), vm)?,
|
||||
self.args
|
||||
.as_slice()
|
||||
.iter()
|
||||
.map(|o| repr_item(o.clone(), vm))
|
||||
.collect::<PyResult<Vec<_>>>()?
|
||||
.join(", ")
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[pyproperty(magic)]
|
||||
|
||||
Reference in New Issue
Block a user