From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.devel,gmane.emacs.tangents Subject: Re: Python vs Lisp (followups to -tangents) Date: Thu, 10 Dec 2015 13:40:39 -0500 Organization: disorganization Message-ID: <86oadyjgew.fsf@gnu.org> References: <87io4lem98.fsf@petton.fr> <56604A9C.7080508@gmail.com> <20151208130529.GA28682@HAL9000> <1c367763-4ba1-4c65-80d1-be1b365c3b35@default> <87lh94hde0.fsf@mbork.pl> Reply-To: sds@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1449772901 31686 80.91.229.3 (10 Dec 2015 18:41:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Dec 2015 18:41:41 +0000 (UTC) Cc: emacs-tangents@gnu.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 10 19:41:27 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a769c-0000cK-1t for ged-emacs-devel@m.gmane.org; Thu, 10 Dec 2015 19:41:24 +0100 Original-Received: from localhost ([::1]:43894 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a769b-0006WH-5L for ged-emacs-devel@m.gmane.org; Thu, 10 Dec 2015 13:41:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a769N-0006Va-Hd for emacs-devel@gnu.org; Thu, 10 Dec 2015 13:41:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a769J-0000pq-9M for emacs-devel@gnu.org; Thu, 10 Dec 2015 13:41:09 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:41304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a769J-0000pe-23 for emacs-devel@gnu.org; Thu, 10 Dec 2015 13:41:05 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a769H-0008R2-Oy for emacs-devel@gnu.org; Thu, 10 Dec 2015 19:41:03 +0100 Original-Received: from 69.74.59.115 ([69.74.59.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Dec 2015 19:41:03 +0100 Original-Received: from sds by 69.74.59.115 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Dec 2015 19:41:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Followup-To: gmane.emacs.devel Original-Lines: 63 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 69.74.59.115 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Cancel-Lock: sha1:1SmNI1Kn728x2y8aOeyqhY3AF3c= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196039 gmane.emacs.tangents:45 Archived-At: > * Random832 [2015-12-10 16:13:30 +0000]: > > On 2015-12-10, Richard Stallman wrote: > >> I skimmed documentation of Python after people told me it was >> fundamentally similar to Lisp. My conclusion is that that is >> not so. `read', `eval', and `print' are all missing in Python. > > I must admit, I don't fully understand what you mean by this. > > Print is the most confusing. As a feature, Lisp's 'print' can be > described as: Produce a string representation which can be read > back of some objects (certainly not *all* objects - not buffers > or subroutines, for example, and it's not structure-preserving > for lists of lists), and display it on standard output. This is false. Nested lists are certainly printed readably: --8<---------------cut here---------------start------------->8--- (defvar l '(1 (2 3) 4 (5 (6 (7 (8)))))) (equal l (read (prin1-to-string l))) ==> t --8<---------------cut here---------------end--------------->8--- > Python's 'repr' could be regarded as an exact match in concept > for prin1-to-string, a building block from which Lisp's 'print' > can be trivially made. The essential feature - that there is a > way to get a string that can be read back for objects for which > it is reasonable/easy - is present. True, but irrelevant. An important feature is missing: repr is not defined for classes automatically. > Python's 'eval'/'exec' normally evaluates code directly from a > string, skipping the need for 'read' entirely. A string is too unstructured. > However, if desired, the 'ast' module provides a rich framework for > working with expression trees - the only difference is that they're > built from class-based objects instead of just being a list of > lists/symbols/literals. These class-based objects cannot be printed readably (IIUC). The point Richard is making is that Python lacks macros, i.e., you cannot easily write code which writes code. You have to either operate at the level of strings (which is hard to get right) or at the level of AST (which is even harder). Even more succinctly, in Lisp data and code are the same: lists of lists, symbols, strings &c. In Python, data is (mostly) strings and code is AST. -- Sam Steingold (http://sds.podval.org/) on Ubuntu 15.10 (wily) X 11.0.11702000 http://www.childpsy.net/ http://memri.org http://islamexposedonline.com http://truepeace.org http://www.dhimmitude.org http://camera.org Old Age Comes at a Bad Time.