Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OrderedDict instead of dict for mk_dict in basic_sps.py #684

Open
fsaad opened this issue Jan 21, 2018 · 0 comments
Open

Use OrderedDict instead of dict for mk_dict in basic_sps.py #684

fsaad opened this issue Jan 21, 2018 · 0 comments
Assignees

Comments

@fsaad
Copy link
Collaborator

fsaad commented Jan 21, 2018

Here is a patch:

diff --git a/backend/lite/basic_sps.py b/backend/lite/basic_sps.py
index 2bb639b..a8134e7 100644
--- a/backend/lite/basic_sps.py
+++ b/backend/lite/basic_sps.py
@@ -19,6 +19,8 @@
 
 import cPickle as pkl
 
+from collections import OrderedDict
+
 from venture.lite.exception import VentureValueError
 from venture.lite.sp import SPType
 from venture.lite.sp_help import binaryPred
@@ -155,8 +157,10 @@ registerBuiltinSP("set_difference", deterministic_typed(lambda l1, l2: [v for v
     descr="set_difference returns the elements in the first list that do not appear in the second"))
 
 def mk_dict(*entries):
-  return dict([(e.lookup(v.VentureNumber(0)), e.lookup(v.VentureNumber(1)))
-               for e in entries])
+  return OrderedDict([
+    (e.lookup(v.VentureNumber(0)), e.lookup(v.VentureNumber(1)))
+    for e in entries
+  ])
 
 registerBuiltinSP("dict",
     deterministic_typed(mk_dict,
@fsaad fsaad self-assigned this Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant