kylebarron commented on issue #40648:
URL: https://github.com/apache/arrow/issues/40648#issuecomment-2008583634

   Being able to infer the input structure also significantly helps static 
typing. For example, I have type hints that I'm writing for geoarrow-rust that 
[include](https://github.com/geoarrow/geoarrow-rs/blob/cfe91bbe15c20b8fd814f7e93294f9c134b9d87a/python/core/python/geoarrow/rust/core/_rust.pyi#L1199-L1205):
   
   ```py
   @overload
   def centroid(input: ArrowArrayExportable) -> PointArray: ...
   @overload
   def centroid(input: ArrowStreamExportable) -> ChunkedPointArray: ...
   def centroid(
       input: ArrowArrayExportable | ArrowStreamExportable,
   ) -> PointArray | ChunkedPointArray: ...
   ```
   
   I'm not sure which overload a type checker would pick if the input object 
had _both_ dunder methods. I suppose it would always return the union. But 
being able to use structural types in this way is quite useful for static type 
checking and IDE autocompletion, which are really sore spots right now with 
pyarrow.


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

Reply via email to