Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter <Peter.Gijsels@gmail.com>2010-03-07 15:43:17 (GMT)
committer Peter <Peter.Gijsels@gmail.com>2010-03-07 15:43:17 (GMT)
commit64ae1d4272131f394a71e403ef081bbfc7acf52d (patch)
treea663389c4732869a12c4f69d1b3ee22b45c51599
parentb02beb3e24ea95ae1ef10537f965a162ebf39ab5 (diff)
using dict.set_default in mo2js.pyHEADmaster
-rwxr-xr-xexamples/6_Maths_matchingAnglesAndShapes/js/mo2js.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/6_Maths_matchingAnglesAndShapes/js/mo2js.py b/examples/6_Maths_matchingAnglesAndShapes/js/mo2js.py
index f2804eb..24fd492 100755
--- a/examples/6_Maths_matchingAnglesAndShapes/js/mo2js.py
+++ b/examples/6_Maths_matchingAnglesAndShapes/js/mo2js.py
@@ -54,9 +54,7 @@ def store_translation(dictionary, key, translation):
p = path(key)
while len(p) > 1:
x = p.pop(0)
- if x not in dictionary:
- dictionary[x] = {}
- dictionary = dictionary[x]
+ dictionary = dictionary.setdefault(x, {})
dictionary[p[0]] = translation
def gettext_json(fp, indent = False):