Feb. 18, 2003
7:13 p.m.
It appears as though you ought to be able to write this as:
return map(operator.getitem, data, b=1)
except that operator.getitem, in common with many builtin functions doesn't accept any keyword arguments.
This is a pity as it cripples most of the situations where you might otherwise want to use this. e.g. add a constant to elements of a list, or multiply by a constant.
For Py2.3, the itertools module can help: itertools.imap(operator.__getitem__, data, itertools.repeat(1)) Raymond Hettinger