Rustom Mody <rustompm...@gmail.com> 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: <suite> Sturla -- https://mail.python.org/mailman/listinfo/python-list