Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-08-03 12:29:15 (GMT)
committer Marion <marion.zepf@gmail.com>2013-08-03 12:29:15 (GMT)
commit8d8aca6f6442e619b2969053a156bdc5a772b9ca (patch)
tree5e8b6c65b41e61f41a4751bec8a4f6cf1f80ecb3 /TurtleArt
parentd09ce71f86932764758c91bf7c69733d1dc287bb (diff)
treat float.__neg__ (minus sign) as a unary operator taking any argument
Diffstat (limited to 'TurtleArt')
-rw-r--r--TurtleArt/taprimitive.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py
index 3fe4696..7f32e34 100644
--- a/TurtleArt/taprimitive.py
+++ b/TurtleArt/taprimitive.py
@@ -290,10 +290,8 @@ class Primitive(object):
# negative numbers
elif self == float.__neg__:
- if (len(new_arg_asts) == 1 and not new_kwarg_asts and
- isinstance(new_arg_asts[0], (ast.Num))):
- pos_value = new_arg_asts[0].n
- return ast.Num(n=-pos_value)
+ if (len(new_arg_asts) == 1 and not new_kwarg_asts):
+ return ast.UnaryOp(op=ast.USub, operand=new_arg_asts[0])
else:
raise ValueError("minus sign (float.__neg__) got unexpected"
" arguments: " + repr(new_arg_asts) +