[Python-ideas] collections.abc.Stream

Bar Harel bzvi7919 at gmail.com
Sat Jun 18 06:20:33 EDT 2016


You're welcome.

Perhaps there should be some kind of reference to it in collections.abc?
Maybe an alias even?

On Sat, Jun 18, 2016, 3:36 AM Ram Rachum <ram at rachum.com> wrote:

> Thanks for the io.IOBase reference!
>
> On Sat, Jun 18, 2016 at 1:21 AM, Bar Harel <bzvi7919 at gmail.com> wrote:
>
>> +1 although isn't io.IOBase already an ABC for file-like objects?
>>
>> On Fri, Jun 17, 2016 at 5:38 PM Michael Selik <michael.selik at gmail.com>
>> wrote:
>>
>>>
>>> On Fri, Jun 17, 2016, 2:01 AM Ram Rachum <ram at rachum.com> wrote:
>>>
>>>> Is there a way to check in Python whether an object is file-like? (Like
>>>> `open`, `StringIO`, etc.) I would think that an abc in collections.abc will
>>>> be the standard solution, like we have for so many other data types, but I
>>>> can't find one.
>>>>
>>>
>>> File-like means different things in different places. Some functions
>>> want the read method, others want readline.
>>>
>>> How about just trying to use the method and catching AttributeError?
>>> _______________________________________________
>>> Python-ideas mailing list
>>> Python-ideas at python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160618/cc642348/attachment.html>


More information about the Python-ideas mailing list