Re: Pythonic way with more than one max possible

2011-07-20 Thread CM
Thanks, everyone. Very helpful! Che -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way with more than one max possible

2011-07-20 Thread Thomas Jollans
On 20/07/11 06:19, Steven D'Aprano wrote: > On Wed, 20 Jul 2011 01:17 pm CM wrote: > >> I have three items in a dict, like this: >> >> the_dict = {'a':1, 'b':2, 'c':3} >> >> but the vals could be anything. I want to configure something else >> based on the "winner" of such a dict, with these rule

Re: Pythonic way with more than one max possible

2011-07-20 Thread Chris Rebert
On Tue, Jul 19, 2011 at 10:10 PM, CM wrote: > On Jul 19, 11:17 pm, CM wrote: >> I have three items in a dict, like this: >> >> the_dict = {'a':1, 'b':2, 'c':3} >> >> but the vals could be anything.  I want to configure something else >> based on the "winner" of such a dict, with these rules: > I

Re: Pythonic way with more than one max possible

2011-07-19 Thread woooee
> 1. In this dict, if there is a UNIQUE max value, then its *key* is the > winner. > 2. If there are any TIES for max value, then the *key* 'b' is the > winner by default. This will store the max value(s) in a list. In case of a tie, you can take the first value in the list, but it may be differe

Re: Pythonic way with more than one max possible

2011-07-19 Thread CM
On Jul 19, 11:17 pm, CM wrote: > I have three items in a dict, like this: > > the_dict = {'a':1, 'b':2, 'c':3} > > but the vals could be anything.  I want to configure something else > based on the "winner" of such a dict, with these rules: > > 1. In this dict, if there is a UNIQUE max value, that

Re: Pythonic way with more than one max possible

2011-07-19 Thread Chris Rebert
On Tue, Jul 19, 2011 at 8:17 PM, CM wrote: > I have three items in a dict, like this: > > the_dict = {'a':1, 'b':2, 'c':3} > > but the vals could be anything.  I want to configure something else > based on the "winner" of such a dict, with these rules: > > 1. In this dict, if there is a UNIQUE max

Re: Pythonic way with more than one max possible

2011-07-19 Thread Steven D'Aprano
On Wed, 20 Jul 2011 01:17 pm CM wrote: > I have three items in a dict, like this: > > the_dict = {'a':1, 'b':2, 'c':3} > > but the vals could be anything. I want to configure something else > based on the "winner" of such a dict, with these rules: > > 1. In this dict, if there is a UNIQUE max

Pythonic way with more than one max possible

2011-07-19 Thread CM
I have three items in a dict, like this: the_dict = {'a':1, 'b':2, 'c':3} but the vals could be anything. I want to configure something else based on the "winner" of such a dict, with these rules: 1. In this dict, if there is a UNIQUE max value, that's the winner. 2. If there are any TIES for m