On Thu, Feb 9, 2012 at 19:26, Guido van Rossum <guido@python.org> wrote:
Are there still Python idioms/patterns/recipes around that depend on refcounting? (There also used to be some well-known anti-patterns that were only bad because of the refcounting, mostly around saving exceptions. But those should all have melted away -- CPython has had auxiliary GC for over a decade.)
There are some simple patterns that are great with refcounting and not so great with garbage collection. We encountered some of these with Mercurial. IIRC, the basic example is just open('foo').read() With refcounting, the file will be closed soon. With garbage collection, it won't. Being able to rely on cleanup per frame/function call is pretty useful. Cheers, Dirkjan