On 2/22/2010 4:29 PM, Bryan wrote:
Sorry about the sorted != ordered mix up. I want to end up with a
*sorted* dict from an unordered list. *Sorting the list is not
practical in this case.* I am using python 2.5, with an ActiveState
recipe for an OrderedDict.
Have you looked at this:
htt
On Feb 22, 3:00 pm, "Diez B. Roggisch" wrote:
> Am 22.02.10 23:48, schrieb Bryan:
>
>
>
> > On Feb 22, 2:16 pm, "Diez B. Roggisch" wrote:
> >> Am 22.02.10 22:29, schrieb Bryan:
>
> >>> On Feb 22, 10:57 am, "Alf P. Steinbach" wrote:
> * Bryan:
>
> > I am looping through a list and crea
Bryan wrote:
On Feb 22, 2:16 pm, "Diez B. Roggisch" wrote:
Am 22.02.10 22:29, schrieb Bryan:
On Feb 22, 10:57 am, "Alf P. Steinbach" wrote:
* Bryan:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
Am 22.02.10 23:48, schrieb Bryan:
On Feb 22, 2:16 pm, "Diez B. Roggisch" wrote:
Am 22.02.10 22:29, schrieb Bryan:
On Feb 22, 10:57 am, "Alf P. Steinbach"wrote:
* Bryan:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't
On Feb 22, 2:16 pm, "Diez B. Roggisch" wrote:
> Am 22.02.10 22:29, schrieb Bryan:
>
>
>
> > On Feb 22, 10:57 am, "Alf P. Steinbach" wrote:
> >> * Bryan:
>
> >>> I am looping through a list and creating a regular dictionary. From
> >>> that dict, I create an ordered dict. I can't think of a way
Am 22.02.10 22:29, schrieb Bryan:
On Feb 22, 10:57 am, "Alf P. Steinbach" wrote:
* Bryan:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
the ordered dict while going through the original loop. Is th
On 22 Feb, 21:29, Bryan wrote:
> Sorry about the sorted != ordered mix up. I want to end up with a
> *sorted* dict from an unordered list. *Sorting the list is not
> practical in this case.* I am using python 2.5, with an ActiveState
> recipe for an OrderedDict.
Why does the dict need to be so
On Feb 22, 10:57 am, "Alf P. Steinbach" wrote:
> * Bryan:
>
>
>
> > I am looping through a list and creating a regular dictionary. From
> > that dict, I create an ordered dict. I can't think of a way to build
> > the ordered dict while going through the original loop. Is there a
> > way I can a
* Bryan:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
the ordered dict while going through the original loop. Is there a
way I can avoid creating the first unordered dict just to get the
ordered dict?
Bryan wrote:
On Feb 22, 9:19 am, MRAB wrote:
Bryan wrote:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
the ordered dict while going through the original loop. Is there a
way I can avoid creating the
Bryan writes:
> I am looping through a list and creating a regular dictionary. From
> that dict, I create an ordered dict. I can't think of a way to build
> the ordered dict while going through the original loop. Is there a
> way I can avoid creating the first unordered dict just to get the
>
Bryan wrote:
On Feb 22, 9:19 am, MRAB wrote:
Bryan wrote:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
the ordered dict while going through the original loop. Is there a
way I can avoid creating the
On Feb 22, 9:19 am, MRAB wrote:
> Bryan wrote:
> > I am looping through a list and creating a regular dictionary. From
> > that dict, I create an ordered dict. I can't think of a way to build
> > the ordered dict while going through the original loop. Is there a
> > way I can avoid creating the
Bryan wrote:
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
the ordered dict while going through the original loop. Is there a
way I can avoid creating the first unordered dict just to get the
ordered dic
On Mon, Feb 22, 2010 at 10:32 AM, Bryan wrote:
> unorderedDict = {}
> for thing in unorderedList:
>if thing.id in unorderedDict:
>UpdateExistingValue(unorderedDict[thing.id])
>else:
>CreateNewValue(unorderedDict[thing.id])
>
> orderedDict = OrderedD
OrderedDict is a class in collection module in python 2.7a3+. Perhaps you
can use it from there.
>>> dir(collections)
['Callable', 'Container', 'Counter', 'Hashable', 'ItemsView', 'Iterable',
'Iterator', 'KeysView', 'Mapping', 'MappingView', 'MutableMapping',
'MutableSequence', 'MutableSet', 'Orde
I am looping through a list and creating a regular dictionary. From
that dict, I create an ordered dict. I can't think of a way to build
the ordered dict while going through the original loop. Is there a
way I can avoid creating the first unordered dict just to get the
ordered dict? Also, I am
17 matches
Mail list logo