thisisnic commented on code in PR #45818:
URL: https://github.com/apache/arrow/pull/45818#discussion_r2135399546


##########
python/pyarrow/scalar.pxi:
##########
@@ -219,6 +220,8 @@ cdef class BooleanScalar(Scalar):
         cdef CBooleanScalar* sp = <CBooleanScalar*> self.wrapped.get()
         return sp.value if sp.is_valid else None
 
+    def __bool__(self):
+        return self.as_py()

Review Comment:
   Thanks, updated now!



##########
python/pyarrow/tests/test_scalars.py:
##########
@@ -219,6 +220,9 @@ def test_bool():
     assert true.as_py() is True
     assert false.as_py() is False
 
+    assert bool(true) is True
+    assert bool(false) is False

Review Comment:
   Great idea, also added



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to