A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033520.html below:

[Python-Dev] [rfc] map enhancement

[Python-Dev] [rfc] map enhancement [Python-Dev] [rfc] map enhancementRaymond Hettinger python@rcn.com
Tue, 18 Feb 2003 22:13:44 -0500
> 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