Deutsch English Français Italiano |
<87v82ugmu8.fsf@lispclub.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Daniel Cerqueira <dan.list@lispclub.com> Newsgroups: comp.lang.lisp Subject: Re: Lprint = ( Lisp-style printing ( of lists and strings (etc.) ) in Python ) Date: Fri, 31 May 2024 13:58:07 +0100 Organization: A noiseless patient Spider Lines: 18 Message-ID: <87v82ugmu8.fsf@lispclub.com> References: <v3bkoj$23bck$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Fri, 31 May 2024 14:58:09 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2321ee7ea5e4a8b1af588046ac3b6676"; logging-data="2355361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XNkYivWYRP0IPANUiBT9pFaiSzmfmFFw=" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:bhtAY+mDlgGErki+KrPX6YQi4Qs= sha1:WZyA+sZUmnxMhmaE9H3PESmM24A= Bytes: 1531 HenHanna <HenHanna@devnull.tb> writes: > ;;; Pls tell me about little tricks you use in Python or Lisp. > (...) > > def lispstr(exp): > # "Convert a Python object back into a Lisp-readable string." > if isinstance(exp, list): > return '(' + ' '.join(map(lispstr, exp)) + ')' > else: > return str(exp) > > def Lprint(x): print(lispstr(x)) This is a LISP group. Mind I say that Python is not a LISP, in case your intelligence haven't reached there yet. Don't post code in unrelated languages. Only LISP code is relevant here.