Currently PySet::empty() returns PyResult<Bound<'_, PySet>>, though AFAIK, this operation can't fail. Or at least it can't fail any more likely than PyDict::new(py) which does not return PyResult. I was initially confused since I was populating an empty set and dict to the same struct.
On the flip side, I understand that PySet::empty is being consistent with PySet::new, which needs to return error for unhashable items. So there is a consistency argument to be made, but in general I guess infallible methods should not return PyResult?
Currently
PySet::empty()returnsPyResult<Bound<'_, PySet>>, though AFAIK, this operation can't fail. Or at least it can't fail any more likely thanPyDict::new(py)which does not returnPyResult. I was initially confused since I was populating an empty set and dict to the same struct.On the flip side, I understand that
PySet::emptyis being consistent withPySet::new, which needs to return error for unhashable items. So there is a consistency argument to be made, but in general I guess infallible methods should not returnPyResult?