sorry all, i did mean greatest to least, thanks for all the help here
shawn
On 8/8/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> Tiger12506 wrote:
> >> Just curious: Is there a reason to use __getitem__() over itemgetter
> (used
> >> in the example in my reply)?
> >
> > __getitem__ is a method b
Tiger12506 wrote:
>> Just curious: Is there a reason to use __getitem__() over itemgetter (used
>> in the example in my reply)?
>
> __getitem__ is a method builtin to a dict object. itemgetter 1) has to be
> imported 2) is more generically used, therefore probably using a more
> generic/slower
wormwood_3 wrote:
>>> You can use d.__getitem__ as the key function for a sort of the keys.
>>> __getitem__() is the special method that is called for indexing a
>>> dictionary (or a list).
>
> Just curious: Is there a reason to use __getitem__() over itemgetter
> (used in the example in my repl
wormwood_3 wrote:
>>> You can use d.__getitem__ as the key function for a sort of the keys.
>>> __getitem__() is the special method that is called for indexing a
>>> dictionary (or a list).
>>>
>
> Just curious: Is there a reason to use __getitem__() over itemgetter (used in
> the example
> Just curious: Is there a reason to use __getitem__() over itemgetter (used
> in the example in my reply)?
__getitem__ is a method builtin to a dict object. itemgetter 1) has to be
imported 2) is more generically used, therefore probably using a more
generic/slower algorithm
JS
>>You can use d.__getitem__ as the key function for a sort of the keys.
>>__getitem__() is the special method that is called for indexing a
>>dictionary (or a list).
Just curious: Is there a reason to use __getitem__() over itemgetter (used in
the example in my reply)?
>>In [24]: d = {'a':21.3
shawn bright wrote:
> hello there all,
> i am wondering how to sort a dictionary that i have by values.
> And i also need to sort them from greatest to least
> like if i have a dictionary
>
> d = {'a':21.3, 'b':32.8, 'c': 12.92}
>
> how could i sort these from least to greatest
> so that the orde
>>hello there all,
>>i am wondering how to sort a dictionary that i have by values.
>>And i also need to sort them from greatest to least
>>like if i have a dictionary
>>
>>d = {'a':21.3, 'b':32.8, 'c': 12.92}
>>
>>how could i sort these from least to greatest
>>so that the order would turn out
>>b
hello there all,
i am wondering how to sort a dictionary that i have by values.
And i also need to sort them from greatest to least
like if i have a dictionary
d = {'a':21.3, 'b':32.8, 'c': 12.92}
how could i sort these from least to greatest
so that the order would turn out
b,a,c
thanks
shawn
_