Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Mark H Harris Newsgroups: comp.lang.python Subject: Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list) Date: Sat, 05 Apr 2014 00:23:58 -0500 Organization: Aioe.org NNTP Server Lines: 44 Message-ID: <533F936E.1000102@gmail.com> References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <5334c38e$0$29994$c3e8da3$5496439d@news.astraweb.com> <53364327$0$29994$c3e8da3$5496439d@news.astraweb.com> <53365F55.2040302@gmail.com> <533836c4$0$29994$c3e8da3$5496439d@news.astraweb.com> <533f47b5$0$29993$c3e8da3$5496439d@news.astraweb.com> NNTP-Posting-Host: +K+LVGHWjDoy/+unkid0vA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.python:69715 On 4/4/14 11:49 PM, Chris Angelico wrote: > On Sat, Apr 5, 2014 at 3:31 PM, Mark H Harris wrote: >> Its has always seemed to me that Java or C++ would be better suited to >> creating python. I wonder will C always be the standard canonical PSF python >> interpreter base language? Has the C python community considered making the >> standard base language Java or C++ ? > > what's the advantage of C++ over C? > A Python interpreter needs to do broadly this: > > 1) Parse a text file into an abstract syntax tree > 2) Compile the AST into bytecode > 3) Execute the bytecode: > 3a) Manage object lifetimes and garbage collection > 3b) Perform lower-level calls > 3c) Efficiently handle namespaces etc > The only advantage of C++ over C is polymorphism, really. There are in my view only three reasons to even use C++: 1) the iostream library, and 2) polymorphism, and 3) operator overloading. If you need to do all three, then C++ is a really good candidate. I am still thinking about the concept of unifying Number; Number as a C++ abstract base class, and an entire Class hierarchy which carries through making *any* Number just work. The ability of the C++ compiler to construct and maintain the virtual function tables would be an advantage. Operator overloading (and maybe templates) would make C++ advantageous also. Guido told me that the modern C python is object oriented. Operator overloading is a big part of this. It seems to me that a modern object oriented language would best be implemented with a true object oriented base language, C++ rather than C. I have always questioned this, just curious why the decision for C was made--- historically, methodologically, and maybe scientifically. It would be tons of work, but maybe not as much as one might think, initially. marcus