Pre-PEP: Dictionary accumulator methods

Peter Otten __peter__ at
Sat Mar 19 10:24:04 CET 2005

Roose wrote:

> Not to belabor the point, but in the example on that page, max(L, key=len)
> could be written max(len(x) for x in L).
No, it can't:

Python 2.5a0 (#2, Mar  5 2005, 17:44:37)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> max(["a", "bbb", "cc"], key=len)


More information about the Python-list mailing list