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/059142.html below:

[Python-Dev] Small any/all enhancement

[Python-Dev] Small any/all enhancementBob Ippolito bob at redivi.com
Tue Dec 27 23:56:31 CET 2005
On Dec 27, 2005, at 5:48 PM, Valentino Volonghi aka Dialtone wrote:

> On Tue, Dec 27, 2005 at 01:50:37PM -0800, Alex Martelli wrote:
>
> I'll answer here for all the people who kindly answered.
>
>> Why would that be better than
>> any(o.some_attribute for o in some_objects)
>> ?
>
> I think it's because lately I've been using common lisp a lot and  
> the approach
> with the test function is pretty common there.
>
> Of course I already knew all the alternatives using map and the  
> generator
> expression, but I felt like mine was clearer for a reader, this is  
> probably
> true but not enough to justify the change.

I think that generator/list expressions are more common practice than  
attrgetter/itemgetter, so I'm not even sure it's clearer.

I don't see the harm in a "key" argument like sorted has, but without  
a key argument it could be extended to take more arguments like max/ 
min do for convenience.  e.g. any(a, b, c) instead of any((a, b, c)).

-bob

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