[Python-Dev] map, filter, zip in future_builtins

David Wolever wolever at cs.toronto.edu
Tue Mar 18 22:26:04 CET 2008


On 18-Mar-08, at 5:10 PM, Guido van Rossum wrote:
> On Tue, Mar 18, 2008 at 3:54 PM, David Wolever  
> <wolever at cs.toronto.edu> wrote:
>>>>> type(map(lambda x: x, [1, 2, 3])) # Python 2.6, with the patch
>>  <type 'itertools.imap'>
>>>>> type(map(lambda x: x, [1, 2, 3])) == map
>>  False
> Doesn't strike me as a terrible problem.
Excellent, I'll go ahead and do the same thing with filter and zip.

> Why is the latter == failing? What's the different between
> type(map(...)) and map?
Because future_builtins.map imports and returns itertools.imap:
def map(*args):
	from itertools import imap	
	return imap(*args)




More information about the Python-Dev mailing list