Python vs Java garbage collection?

Isaac To kkto at csis.hku.hk
Mon Dec 23 00:14:17 EST 2002


>>>>> "Erik" == Erik Max Francis <max at alcyone.com> writes:

    Erik> Software tends to have a much longer lifetime and breadth than you
    Erik> first expect.  One day you may find yourself in a situation where
    Erik> you wish you hadn't been so short-sighted when you first wrote
    Erik> that code.

Hm... what if by that time I have already switched to a completely different
language?

    >> And, you simply cannot say that's broken if I have no way to test it
    >> (how about a flag of Python to "disable garbage collection"?  Then
    >> one can reasonably test whether he is relying on the GC too much.).

    Erik> Relying on a certain form of unspecified behavior is "broken,"
    Erik> whether or not it happens to work for you right here, right now.

Okay, if you want to say it's broken, that's up to you, but then the code of
everybody tends to be "broken" anyway.

Anyway, my point is not that it is good to rely on GC for things like
closing files (whether it is good depends on the definition of GC: if it is
"to collect unused memory", then it is bad.  If its definition is "to
collect unused resources", then it is good, at least in some cases).  It is
that currently if you use C-Python there is no way, or is very costly, to
test that your code rely on "unspecified" behaviour of GCs.

Regards,
Isaac.



More information about the Python-list mailing list