Skip to content

Commit

Permalink
Replace defaultdict with OrderedDict
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Dec 16, 2017
1 parent c18aa50 commit 17ed18b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/sugarscape_cg/sugarscape/schedule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import random
from collections import defaultdict
from collections import OrderedDict

from mesa.time import RandomActivation

Expand All @@ -14,11 +14,11 @@ class RandomActivationByBreed(RandomActivation):
Assumes that all agents have a step() method.
'''
agents_by_breed = defaultdict(list)
agents_by_breed = OrderedDict(dict)

def __init__(self, model):
super().__init__(model)
self.agents_by_breed = defaultdict(list)
self.agents_by_breed = OrderedDict(dict)

def add(self, agent):
'''
Expand Down
6 changes: 3 additions & 3 deletions examples/wolf_sheep/wolf_sheep/schedule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import random
from collections import defaultdict
from collections import OrderedDict

from mesa.time import RandomActivation

Expand All @@ -14,11 +14,11 @@ class RandomActivationByBreed(RandomActivation):
Assumes that all agents have a step() method.
'''
agents_by_breed = defaultdict(dict)
agents_by_breed = OrderedDict(dict)

def __init__(self, model):
super().__init__(model)
self.agents_by_breed = defaultdict(dict)
self.agents_by_breed = OrderedDict(dict)

def add(self, agent):
'''
Expand Down

0 comments on commit 17ed18b

Please sign in to comment.