Python 2:
map(int, ['1','2','3']) # => [1,2,3]
…
def foo(l, dtype=long):
return map(dtype, l)
In Python 3, map() returns a map object, so you need to convert it to a list:
list(map(int, ['1','2','3'])) # => [1,2,3]
…
def foo(l, dtype=long):
return list(map(dtype, l))