Re: any() and all() Was: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Roose
Ah OK, I stand corrected. Whoops. I just read the web page and thought the wrong thing, that makes sense. > Think about it. A key= function is quite a different thing. It provides a > *temporary* comparison key while retaining the original value. IOW, your > re-write is incorrect: > > >>> L =

any() and all() Was: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Raymond Hettinger
[Roose] > Actually I was just looking at Python 2.5 docs since you mentioned this. > > http://www.python.org/dev/doc/devel/whatsnew/node3.html > > It says min() and max() will gain a key function parameter, and sort() > gained one in Python 2.4 (news to me). It also appears in itertools.groupby()

any() and all() Was: Pre-PEP: Dictionary accumulator methods

2005-03-19 Thread Raymond Hettinger
> > Py2.5 is already going to include any() and all() as builtins. The > > signature does not include a function, identity or otherwise. > > Instead, the caller can > > write a listcomp or genexp that evaluates to True or False: > > > > any(x >= 42 for x in data) [Roose] > Oh great, I just s