> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4