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/07/07 06:20:34 UTC

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

jorisvandenbossche commented on PR #13454:
URL: https://github.com/apache/arrow/pull/13454#issuecomment-1177140141

   One small comment: this method should maybe be not "public" on the type? (there should be no reason for a _user_ of the extension type (not implementor) to ever call this method on the type object) 
   So we could also follow the similar pattern as the other non-public methods we already have that can be overridden and call this something like `__arrow_ext_scalar_as_py__` ?
   
   ---
   
   Something that I didn't think about when opening the JIRA originally, but a potentially different way to enable basically the same ability to override `as_py()` would be to allow the user to sublcass `ExtensionScalar`, and then specify this class (in the same way as you can sublcass `ExtensionArray`, and specify this in `ExtensionType.__arrow_ext_class__`). 
   That way, you have full control over that scalar class (and for example also add custom attributes), and thus also can override the default `as_py()` method.
   
   I am not really sure this is a better way, though (it's a bit more generic, but the question is whether this will be needed in practice).


-- 
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