Supply condition in function call

Ian Kelly ian.g.kelly at gmail.com
Thu Mar 26 22:25:17 EDT 2015


On Thu, Mar 26, 2015 at 7:56 PM, Chris Angelico <rosuav at gmail.com> wrote:
>> On a more specific note, its the 1st line:
>>
>> class filter(object)
>>
>> which knocks me off.
>> If a more restricted type from the ABC was shown which exactly captures all
>> the iterator-specific stuff like __iter__, __next__ it would sure help (me)
>
> But there's no point in subclassing for everything. In this case,
> filter doesn't subclass anything but object, so there's no value in
> stating anything else. You want to know if it's iterable? Check for an
> __iter__ method. Etcetera.

Also, filter is a builtin, while collections.abc.Iterable is in a
library module written in Python, so there's a bootstrapping problem
with having the one inherit from the other.



More information about the Python-list mailing list