Supply condition in function call
Dave Angel
davea at davea.name
Fri Mar 27 08:43:03 EDT 2015
On 03/26/2015 09:41 PM, Rustom Mody wrote:
> On Thursday, March 26, 2015 at 11:30:57 AM UTC+5:30, Chris Angelico wrote:
>>
>>
>> Python 3.5.0a0 (default:4709290253e3, Jan 20 2015, 21:48:07)
>> [GCC 4.7.2] on linux
>>
>> class filter(object)
>> | filter(function or None, iterable) --> filter object
>> |
>> | Return an iterator yielding those items of iterable for which function(item)
>> | is true. If function is None, return the items that are true.
>> |
>> | Methods defined here:
...
> 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)
>
Since it's not actually derived from anything else, I'd leave that part
alone. But it could be useful to add something like:
ducktype: collections.abc.Iterable
if nothing else, it'd get beginners to the language to start thinking
more of what duck typing is, in Python.
--
DaveA
More information about the Python-list
mailing list