diff options
author | Walter Bender <walter.bender@gmail.com> | 2013-05-07 16:24:51 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2013-05-07 16:24:51 (GMT) |
commit | 54e48c22d28c5e573b5af9dba0754d54a2f1b24a (patch) | |
tree | b5c9d784f50e9215a4f1ad07c65762161ef43586 | |
parent | 26bd420885e29683cef9a79f317dd9003124d472 (diff) |
ord is not a type
-rw-r--r-- | TurtleArt/tabasics.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py index 81eba2d..07cd6d6 100644 --- a/TurtleArt/tabasics.py +++ b/TurtleArt/tabasics.py @@ -79,9 +79,13 @@ def _color_to_num(c): def _num_type(x): """ Is x a number type? """ - if isinstance(x, (int, float, ord)): + if isinstance(x, (int, float)): return True - return False + try: + ord(x) + return True + finally: + return False def _millisecond(): @@ -1362,8 +1366,10 @@ variable')) """ Try to comvert a string to a number """ if isinstance(x, (int, float)): return(x) - if isinstance(x, ord): - return(int(x)) + try: + return int(ord(x)) + finally: + pass if isinstance(x, list): raise logoerror("#syntaxerror") if x in COLORDICT: |