Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'context': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language.': 0.14; 'corresponds': 0.16; 'foo()': 0.16; 'garbage': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:type': 0.16; 'subject:which': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'header :User-Agent:1': 0.23; 'subject:like': 0.24; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'statement': 0.30; '(which': 0.31; 'subject: (': 0.35; 'but': 0.35; 'c++': 0.36; 'subject:data': 0.36; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'how': 0.40; 'ensure': 0.60; 'bar:': 0.84; 'hardly': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Sturla Molden Subject: Re: RAII vs gc (was fortran lib which provide python like data type) Date: Fri, 30 Jan 2015 21:28:28 +0000 (UTC) References: <0b8db0f6-75c5-4a8f-a9a5-51fa936b306e@googlegroups.com> <8ff4c8aa-a858-481f-8964-7c794f848de2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 58-175-11.connect.netcom.no User-Agent: NewsTap/4.0.1 (iPad) X-: 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: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422653315 news.xs4all.nl 2894 [2001:888:2000:d::a6]:33109 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84919 Rustom Mody wrote: > The case of RAII vs gc is hardly conclusive: > > http://stackoverflow.com/questions/228620/garbage-collection-in-c-why The purpose of RAII is not to be an alternative to garbage collection (which the those answers imply), but to ensure deterministc execution of setup and tear-down code. The Python equivalent of RAII is not garbage collection but context managers. Those answers is a testimony to how little the majority of C++ users actually understand about the language. A C++ statement with RAII like { Foo bar(); // suite } is not equivalent to bar = Foo() in Python. It actually corresponds to with Foo() as bar: Sturla