AlenkaF commented on code in PR #45818:
URL: https://github.com/apache/arrow/pull/45818#discussion_r2009726204
##########
python/pyarrow/scalar.pxi:
##########
@@ -240,6 +240,10 @@ cdef class UInt8Scalar(Scalar):
cdef CUInt8Scalar* sp = <CUInt8Scalar*> self.wrapped.get()
return sp.value if sp.is_valid else None
+ def __int__(self):
+
+ return(self.as_py())
+
Review Comment:
I would be nice to have a Scalar subclass from which all existing int-based
classes would inherit from, like in
[BaseExtensionType(DataType)](https://github.com/apache/arrow/blob/40c5300edc6ccc0ea4a9131722628ac6203ce806/python/pyarrow/types.pxi#L1644).
_But_ we would need to do some gymnastic to move `as_py` to this newly
created, lets say `BaseIntScalar` class. That, I think, would make it more of
an effort in the end.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]