On 07/31/2014 11:46 PM, Ben Finney wrote:

The ‘max’ function can be told how to determine the ordering of items,
by specifying a key parameter. The parameter is specified by giving a
value; that value is a function.

Hmmm... might just have had a break-thru here: so max() iterates thru counts, which because its the only non-keyword argument provided has to be an iterable (if I'm reading this correctly: https://docs.python.org/3/library/functions.html?highlight=max#max). It takes each dict key ('a', 'b', 'c'), feeds them in turn to counts.get() like so: counts.get('a'), counts.get('b'), counts.get('c'), which should return the corresponding dict values (1, 22, 100), and then max() returns the highest value seen.

Is that about right?

Monte

--
Shiny!  Let's be bad guys.

Reach me @ memilanuk (at) gmail dot com
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to