1.1 --- a/translator.py Tue Dec 13 22:48:28 2016 +0100
1.2 +++ b/translator.py Tue Dec 13 23:26:33 2016 +0100
1.3 @@ -205,10 +205,19 @@
1.4
1.5 "A predefined constant reference."
1.6
1.7 - def __init__(self, value):
1.8 + def __init__(self, value, expr=None):
1.9 self.value = value
1.10 + self.expr = expr
1.11
1.12 def __str__(self):
1.13 +
1.14 + # Eliminate predefined constant assignments.
1.15 +
1.16 + if self.expr:
1.17 + return ""
1.18 +
1.19 + # Generate the specific constants.
1.20 +
1.21 if self.value in ("False", "True"):
1.22 return encode_path("__builtins__.boolean.%s" % self.value)
1.23 elif self.value == "None":
1.24 @@ -1327,7 +1336,7 @@
1.25 # Determine whether the name refers to a static external entity.
1.26
1.27 if n.name in predefined_constants:
1.28 - return PredefinedConstantRef(n.name)
1.29 + return PredefinedConstantRef(n.name, expr)
1.30
1.31 # Convert literal references, operator function names, and print
1.32 # function names to references.