[Python-Dev] Small any/all enhancement

Nick Coghlan ncoghlan at gmail.com
Wed Dec 28 05:13:17 CET 2005


Bob Ippolito wrote:
> 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)).

Hmm, I think you just found the use case for fixing the current lack of 
support for keyword-only arguments - it allows conveniences like this, while 
still allowing keyword arguments to tailor function behaviour.

For example, min & max could grow a "key" argument analogous to sorted's (e.g. 
to find the person with the highest score in a list of players).

(Guido's already approved the concept of permitting keyword arguments to be 
supplied after a * entry in a function call. I don't remember if he expressed 
an opinion on allowing the same syntax in a function definition to define 
keyword only arguments).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list