Python 2.0

Graham Matthews graham at
Wed Jun 2 22:50:33 CEST 1999

Aahz Maruch (aahz at wrote:
: I'm curious: does GC provide any advantages other than its ability to
: deal with circular references?

You have obviously never worked on a large C project! GC promotes code
modularity. For example say I am using some library, L, and I do a call
to one of it's routines, say f, as follows,

	b = some_temporarily_allocated_thing
	a = L.f(some_arguments_including_b)

Now at this point does my code have to decref b, delete b, incref a?
The answers to all these questions depends on the precise calling
conventions of the routine f in L. Now what say I had called function
g in L, instead of f, then what would have been the answer to those
questions? It depends on the conventions for g, which may of course
be different to those for f. Moreover what happens if I upgrade to
a new version of the library L -- then what are the answers to the
above questions (they might depend on the version number of the
library L!).

In a garbage collection system you have none of these problems. Code
modularity is improved.


PS: before anyone scoffs I should note that I have encountered all of 
the above in large C projects. As well as the usual errors where the
library code forget to incref/decref, or decreffed where they should
have increffed, etc.
             Like a bird on a wire
        Like a drunk in a midnight choir
            I have tried in my way
                  To be free

More information about the Python-list mailing list