futurize stage2 core

This commit is contained in:
Simon Forman
2020-04-23 23:33:23 -07:00
parent e758d7d2be
commit 29d510eb46
5 changed files with 19 additions and 11 deletions
+1 -2
View File
@@ -72,6 +72,7 @@ printed left-to-right. These functions are written to support :doc:`../pretty`.
'''
from builtins import map
def list_to_stack(el, stack=()):
'''Convert a Python list (or other sequence) to a Joy stack::
@@ -129,7 +130,6 @@ def expression_to_string(expression):
def _to_string(stack, f):
if isinstance(stack, long): return str(stack).rstrip('L')
if not isinstance(stack, tuple): return repr(stack)
if not stack: return '' # shortcut
return ' '.join(map(_s, f(stack)))
@@ -137,7 +137,6 @@ def _to_string(stack, f):
_s = lambda s: (
'[%s]' % expression_to_string(s) if isinstance(s, tuple)
else str(s).rstrip('L') if isinstance(s, long)
else repr(s)
)