Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'operator': 0.03; 'syntax': 0.04; 'guido': 0.05; 'interpreter': 0.05; 'tree': 0.05; 'subject:Python': 0.06; 'class,': 0.07; 'compiler': 0.07; 'think,': 0.07; 'seemed': 0.09; 'subject:language': 0.09; 'psf': 0.10; 'python': 0.11; 'language,': 0.12; '*any*': 0.16; 'advantage.': 0.16; 'ast': 0.16; 'bytecode': 0.16; 'garbage': 0.16; 'hierarchy': 0.16; 'language?': 0.16; 'questioned': 0.16; 'received:10.20.200': 0.16; 'received:209.225': 0.16; 'received:209.225.8': 0.16; 'received:charter.net': 0.16; 'subject: \n ': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'work,': 0.20; 'seems': 0.21; 'creating': 0.23; 'header:User-Agent:1': 0.23; 'library,': 0.24; 'oriented': 0.24; 'parse': 0.24; 'java': 0.24; 'tables': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'wonder': 0.29; 'subject:list': 0.30; 'work.': 0.31; 'candidate.': 0.31; 'file': 0.32; 'class': 0.32; 'this.': 0.32; 'text': 0.33; 'community': 0.33; 'implemented': 0.33; 'received:10.20': 0.33; 'maybe': 0.34; 'etc': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'c++': 0.36; 'curious': 0.36; 'virtual': 0.37; 'received:209': 0.37; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'handle': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'ability': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'entire': 0.61; 'making': 0.63; 'received:96': 0.65; 'subject:this': 0.83; 'c++:': 0.84; 'overloading': 0.84; 'unifying': 0.84; 'canonical': 0.91; 'carries': 0.91; 'suited': 0.93 X-Authority-Analysis: v=2.0 cv=Q7eKePKa c=1 sm=1 a=EBsYl1X+Lq2xj3QUCo3MmA==:17 a=zewopLiEtFcA:10 a=Ttv1ZzyyB0MA:10 a=nDghuxUhq_wA:10 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=YmBpNAfMz2Lwrpo1_jgA:9 a=QEXdDO2ut3YA:10 a=MSl-tDqOz04A:10 a=E1eR3GlqM6zXF5MI:21 a=ErVy_O2co0yvfLuT:21 a=EBsYl1X+Lq2xj3QUCo3MmA==:117 Date: Sat, 05 Apr 2014 00:23:58 -0500 From: Mark H Harris User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 Newsgroups: comp.lang.python To: python-list@python.org Subject: Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list) 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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396678023 news.xs4all.nl 2911 [2001:888:2000:d::a6]:50458 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69722 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