newbie seeks advise.

Erik Max Francis max at alcyone.com
Fri Sep 20 10:28:22 CEST 2002


Gerhard Häring wrote:

> If you want to program a max() function yourself, you can convert the
> tuple to a list using list(data), then sorting it, then finding the
> largest element yourself.

Or just scan the list, keeping track of the largest element you've seen
so far.  When you're done, the largest one you've seen is the largest in
the list.  This has better performance than sorting.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ He who has a _why_ to live can bear with almost any _how_.
\__/ Friedrich Nietzsche
    REALpolitik / http://www.realpolitik.com/
 Get your own customized newsfeed online in realtime ... for free!



More information about the Python-list mailing list