maximum() efficency

Steve R. Hastings steve at
Mon Mar 27 02:10:18 CEST 2006

Actually, now that I think about it, the version using iter() has one
advantage over your version: it will work correctly if passed either a
list or an iterator.  So, for versions of Python that have iterators, I'd
use the iter() version, but for older versions of Python, I'd use your

P.S. I benchmarked your version; it ran in 22.0 seconds, just a gnat's
whisker faster than the iter() version.
Steve R. Hastings    "Vita est"
steve at

More information about the Python-list mailing list