[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Nick Coghlan
Nick Coghlan added the comment: As Robert noted, the map() and filter() builtins in Python 3 are already lazy and there's no reason to expand the iterator protocol for this functionality. Map and filter also have dedicated syntax in the form of comprehensions and generator expressions: i

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Robert Lehmann
Robert Lehmann added the comment: Your proposal seems two-fold: (a) make map/filter lazy and (b) have them as methods instead of functions. It seems Tim borrowed Guido's time machine and already implemented (a) in Python 3.x, see http://docs.python.org/py3k/library/functions.html#map and htt

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Ramchandra Apte
Ramchandra Apte added the comment: Sorry, To clarify: Python 2.7 is in bug-fix mode which means only minor enhancements are allowed. -- ___ Python tracker ___ __

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Ramchandra Apte
Ramchandra Apte added the comment: I think this is quite a major change to Python and this needs a PEP BTW issue912738 and therefore this bug no longer applies to Python 3. In Python 3 map returns an iterator. Even if you wanted to implement this feature in Python 2, it is not possible because

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Ramchandra Apte
Ramchandra Apte added the comment: Sorry, small mistake. Actually all the other Python 2.x releases are in security-fix mode. -- ___ Python tracker ___ _

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Vladimir Berkutov
New submission from Vladimir Berkutov : It might be useful to introduce a new map() and filter() methods to iterators and iterables. Both methods should accept lambda/function which transforms a single argument into value. Both methods should return another iterator. # proposed methods usage: