wjones127 commented on code in PR #13454: URL: https://github.com/apache/arrow/pull/13454#discussion_r908768502
########## docs/source/python/extending_types.rst: ########## @@ -286,6 +286,36 @@ are available). The same ``__arrow_ext_class__`` specialization can be used with custom types defined by subclassing :class:`ExtensionType`. +Custom scalar conversion +~~~~~~~~~~~~~~~~~~~~~~~~ + +If you want scalars of your custom extension type to convert to a custom type when +:meth:`ExtensionScalar.as_py()` is called, you can override the :meth:`ExtensionType.scalar_as_py()` +method. For example, if we wanted the above example 3D point type to return a tuple instead +of a list, we would implement:: Review Comment: ```suggestion method. For example, if we wanted the above example 3D point type to return a custom 3D point class instead of a list, we would implement:: ``` -- 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]
