Test whether a python object is `None`.
(&self, obj: &PyObject)
| 98 | |
| 99 | /// Test whether a python object is `None`. |
| 100 | pub fn is_none(&self, obj: &PyObject) -> bool { |
| 101 | obj.is(&self.ctx.none) |
| 102 | } |
| 103 | pub fn option_if_none(&self, obj: PyObjectRef) -> Option<PyObjectRef> { |
| 104 | if self.is_none(&obj) { None } else { Some(obj) } |
| 105 | } |