replace None (for Python 2)


In Python 2 map used to extend the shorter lists by None values. So to avoid exceptions, we had some exra code replacing the None values by 0, using the ternary operator.

examples/functional/map_add_none.py
v1 = [1, 3, 5, 9]
v2 = [2, 6, 4, 8, 10]

print(map(lambda x,y: (0 if x is None else x) + (0 if y is None else y), v1, v2))
# [3, 9, 9, 17, 10]