diff options
author | Marion <marion.zepf@gmail.com> | 2013-08-29 14:41:43 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-08-29 14:41:43 (GMT) |
commit | 355ff738875299f44c9eda210102b22223818272 (patch) | |
tree | cb69cd7b331a30913fe7fd365c09f89ba3517ff6 /TurtleArt/tatype.py | |
parent | 203303db1b9b75d09e55b9618b980188256a6258 (diff) |
re-implement python export functionality using the type system
Diffstat (limited to 'TurtleArt/tatype.py')
-rw-r--r-- | TurtleArt/tatype.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/TurtleArt/tatype.py b/TurtleArt/tatype.py index e6ffbb9..477e028 100644 --- a/TurtleArt/tatype.py +++ b/TurtleArt/tatype.py @@ -106,10 +106,11 @@ def get_type(x): else: return (get_type(value)[0], True) elif isinstance(x, ast.Call): - if x.func.__name__ in ('float', 'int'): - return (x.func.__name__, True) - elif x.func.__name__ in ('repr', 'str', 'unicode'): - return (TYPE_STRING, True) + if isinstance(x.func, ast.Name): + if x.func.id in ('float', 'int'): + return (x.func.__name__, True) + elif x.func.id in ('repr', 'str', 'unicode'): + return (TYPE_STRING, True) return (TYPE_OBJECT, isinstance(x, ast.AST)) @@ -317,7 +318,7 @@ def convert(x, new_type, old_type=None, converter=None): kwargs=None) else: func_name = converter.__name__ - return get_call_ast(func_name, y) + return get_call_ast(func_name, [y]) else: return converter(y) |