MCPcopy
hub / github.com/fluentpython/example-code-2e / lispstr

Function lispstr

18-with-match/lispy/py3.10/lis.py:131–136  ·  view source on GitHub ↗

Convert a Python object back into a Lisp-readable string.

(exp: object)

Source from the content-addressed store, hash-verified

129 print(lispstr(val))
130
131def lispstr(exp: object) -> str:
132 "Convert a Python object back into a Lisp-readable string."
133 if isinstance(exp, list):
134 return '(' + ' '.join(map(lispstr, exp)) + ')'
135 else:
136 return str(exp)
137# end::REPL[]
138
139

Callers 3

standard_envFunction · 0.70
replFunction · 0.70
evaluateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected