[ 
https://issues.apache.org/jira/browse/ARROW-2816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539670#comment-16539670
 ] 

Antoine Pitrou commented on ARROW-2816:
---------------------------------------

Dimitri, hmm, you are right. It could be possible to solve that by using 
composition: have a {{cdef}} class that contains the actual file handle, and 
then a regular class inheriting from {{RawIOBase}} that delegates to methods of 
the {{cdef}} class.

Otherwise we can just implement {{__iter__}}  and {{__next__}}.

> [Python] Add __iter__ method to NativeFile
> ------------------------------------------
>
>                 Key: ARROW-2816
>                 URL: https://issues.apache.org/jira/browse/ARROW-2816
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Wes McKinney
>            Priority: Major
>             Fix For: 0.10.0
>
>
> Copied from https://github.com/apache/arrow/issues/2114
> {code}
> Currently, NativeFile does not pass the check of pandas for being a 
> "file-like" object because it does not have __iter__ method. It can be easily 
> added using code from native python io module as a reference. Another way 
> would be to subclass io.IOBase.
> The exact code of pandas check can be found here.
> Code for __iter__ method and io.IOBase can be found here.
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to