pitrou opened a new issue, #45653:
URL: https://github.com/apache/arrow/issues/45653

   ### Describe the enhancement requested
   
   To make PyArrow scalars easier to use with non-PyArrow functions, we should 
define appropriate methods and protocols for specific scalar subclasses.
   
   Examples:
   * integer scalars should implement `__int__`
   * floating-point scalars should implement `__float__`
   * binary scalars should implement 
[`__bytes__`](https://docs.python.org/3.13/reference/datamodel.html#object.__bytes__)
 and perhaps the [buffer 
protocol](https://docs.python.org/3.13/reference/datamodel.html#object.__buffer__)
   * list-like scalars could implement 
[`Sequence`](https://docs.python.org/3.13/library/collections.abc.html#collections.abc.Sequence)
   * map scalars could implement 
[`Mapping`](https://docs.python.org/3.13/library/collections.abc.html#collections.abc.Mapping)
   * struct scalars could implement both Sequence and Mapping (?)
   
   Note that some of this exists (unvoluntarily?) but is broken:
   ```python
   >>> a, b = pc.min_max([1,2,3])
   >>> a  # expecting 1
   'min'
   >>> b  # expecting 3
   'max'
   ```
   
   
   
   ### Component(s)
   
   Python


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to