[issue6379] Add first() function that would take first matching case from an iterator

2009-06-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: We've already got one. Thanks ;-) -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-li

[issue6379] Add first() function that would take first matching case from an iterator

2009-06-29 Thread Martin v . Löwis
Martin v. Löwis added the comment: Python already supports that, in the itertools module: itertools.ifilter(lambda x:self._value.has_key(x), ['es-AR','es','en-US']).next() -- nosy: +loewis ___ Python tracker

[issue6379] Add first() function that would take first matching case from an iterator

2009-06-29 Thread Benjamin Peterson
Benjamin Peterson added the comment: Please propose this on the python-ideas list first. -- nosy: +benjamin.peterson resolution: -> rejected status: open -> closed ___ Python tracker __

[issue6379] Add first() function that would take first matching case from an iterator

2009-06-29 Thread Zbigniew Braniecki
New submission from Zbigniew Braniecki : Python has a very useful function any() that will iterate over a list and break on the first matching case. Now, it would be great to have similar function but with: a) ability to use a callback for matching test b) that would return the first match so s