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/2005-December/059127.html below:

[Python-Dev] Small any/all enhancement

[Python-Dev] Small any/all enhancement [Python-Dev] Small any/all enhancementValentino Volonghi aka Dialtone dialtone at divmod.com
Tue Dec 27 21:45:01 CET 2005
I see that Python 2.5 will include a simple implementation of any/all.

What I would like to ask, before it's too late, is if it's possible to add an
optional test argument.

any(iterable, test=bool) and all(iterable, test=bool)

These would be the new proposed APIs. The usecase is to be able to extract
attributes from objects or simply to have arbitrary checks like:

import operator

any(some_objects, test=operator.attrgetter('some_attribute'))

or

def zerop(x):
    return x==0

all(some_objects, zerop)

instead of preprocessing the generator with a generator expression before
passing it to any/all.

Thanks.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-dev/attachments/20051227/e76dae5b/attachment.pgp
More information about the Python-Dev mailing list

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