[Python-Dev] Adding any() and all()
barry at python.org
Fri Mar 11 18:49:04 CET 2005
On Fri, 2005-03-11 at 12:18, Raymond Hettinger wrote:
> I suspect that lambda will be the only bone of contention. The reduce()
> function can be moved to the functional module. The map() and filter()
> functions are already covered by the itertools module.
I'm fine seeing reduce() eventually go; I've used it maybe a handful of
times in all my years of Python. Using a list comprehension instead of
map() is fine too, but I'll miss the filter(None, seq) idiom. Ping's
suggested list comprehension abbreviation, i.e.:
[x in seq if x] == [x for x in seq if x]
> Lambda will be more difficult. Eric Raymond adapted an anti-gun control
> slogan and said "you can pry lambda out of my cold dead hands." A bunch
> of folks will sorely miss the ability to create anonymous functions on
> the fly. When lambda is used for deferred argument evaluation (a la PEP
> 312), the def syntax is a crummy substitute.
Yeah, I'm with you here. As warty as lambda is, it just is so damn
convenient some times. I've recently been using it as a companion to
property(), providing concise definitions of read-only attributes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20050311/b4e0befc/attachment.pgp
More information about the Python-Dev