[New-bugs-announce] [issue24446] imap and map inconsistent behaviour

Ernesto Alfonso report at bugs.python.org
Sun Jun 14 00:05:16 CEST 2015


New submission from Ernesto Alfonso:

itertools.imap and map in Python 2.7 produces inconsistent behaviour when mapping the null (None) function over multiple sequences.
 


>>> [a for a in map(None, list("abcd"), range(3))]
[('a', 0), ('b', 1), ('c', 2), ('d', None)]
>>> from itertools import imap
>>> [a for a in imap(None, list("abcd"), range(3))]
[('a', 0), ('b', 1), ('c', 2)]
>>> [a for a in map(None, list("abcd"), range(3))] == [a for a in imap(None, list("abcd"), range(3))]
False
>>> 



This inconsistent and unintuitive behvaiour caused a bug in my program

----------
components: Interpreter Core, Library (Lib)
messages: 245329
nosy: Ernesto Alfonso
priority: normal
severity: normal
status: open
title: imap and map inconsistent behaviour
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24446>
_______________________________________


More information about the New-bugs-announce mailing list