This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients hynek, loewis, lukasz.langa, ncoghlan, rhettinger, serhiy.storchaka
Date 2013-08-04.11:38:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CADiSq7duwPoFDCh3fWQ9Uh_zBr95YqwWOxtQkZiHKpqUOzeSZg@mail.gmail.com>
In-reply-to <1375615644.73.0.626898110146.issue18652@psf.upfronthosting.co.za>
Content
Serhiy, Hynek covered the issue with the status quo in the original
proposal.The existing alternative are painful to try and decipher by
comparison with the named function:

    filterednext([0, None, False, [], (), 42])
vs
    next(filter(None, [0, None, False, [], (), 42]))

    filterednext([0, None, False, [], ()], default=42)
vs
    next(filter(None, [0, None, False, [], (), 42]), 42)

    filterednext([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0)
vs
    next(filter(lambda x: x % 2 == 0, [1, 1, 3, 4, 5]))

    m = filterednext(regexp.match('abc') for regexp in [re1, re2])
vs
    m = next(filter(None, (regexp.match('abc') for regexp in [re1, re2])))

Hynek - the Python 3 filter is an iterator, so it works like the
itertools.ifilter version in Python 2.
History
Date User Action Args
2013-08-04 11:38:46ncoghlansetrecipients: + ncoghlan, loewis, rhettinger, lukasz.langa, hynek, serhiy.storchaka
2013-08-04 11:38:45ncoghlanlinkissue18652 messages
2013-08-04 11:38:45ncoghlancreate