diff options
author | Marion <marion.zepf@gmail.com> | 2013-08-15 12:14:11 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-08-15 12:14:11 (GMT) |
commit | 0417bd0f7ae460c25c15321e7b4cd96addfc580e (patch) | |
tree | 0b085d52955ecd3059f2c49694d4f8142e905ba0 | |
parent | 6998299fef2fbe1585e170b6732737ddc981c7ea (diff) |
use float() instead of int() to convert Colors to numbers
-rw-r--r-- | TurtleArt/taprimitive.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/TurtleArt/taprimitive.py b/TurtleArt/taprimitive.py index ab6bfe9..b92f2cc 100644 --- a/TurtleArt/taprimitive.py +++ b/TurtleArt/taprimitive.py @@ -581,7 +581,7 @@ class Primitive(object): 2. Convert a string containing a number into a float. 3. Convert a single character to its ASCII integer value. 4. Extract the first element of a list and convert it to a number. - 5. Convert a Color to an int. + 5. Convert a Color to a float. Return None if the value cannot be converted to a number. """ # 1. number if isinstance(value, (float, int, long, ast.Num)): @@ -627,9 +627,9 @@ class Primitive(object): return None # 5. Color elif isinstance(value, Color): - converted = int(value) + converted = float(value) if convert_to_ast: - conversion_ast = ast.Call(func=ast.Name(id='int', + conversion_ast = ast.Call(func=ast.Name(id='float', ctx=ast.Load), args=[value_ast], keywords={}, |