You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/28 17:33:54 UTC

[GitHub] [arrow] wjones127 commented on a diff in pull request #13454: ARROW-13612: [Python] Allow specifying a custom type for converting ExtensionScalar to python object

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: github-unsubscribe@arrow.apache.org

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