Python vs Java garbage collection?

Isaac To kkto at csis.hku.hk
Sat Dec 28 01:59:53 EST 2002


>>>>> "Stuart" == Stuart D Gathman <stuart at bmsi.com> writes:

    Stuart> 1) This feature should not reclaim memory, only call __del__().
    Stuart> If references were still live, the effect would be the same as
    Stuart> calling __del__() on a live object.

    Stuart> 2) __del__() would get called again when memory is actually
    Stuart> reclaimed.  Therefore, your feature would be much safer if it
    Stuart> called another special function - say close() or dispose() at
    Stuart> the end of the block.

    Stuart> 3) There is probably a way to do what you want without
    Stuart> additional syntax:

    Stuart> def foo(): mymutex = auto(acquire_mutex()) myfile =
    Stuart> auto(open(filename,'w') mysocket = auto(open_socket())
    Stuart> do_stuff()

Is there a PEP for that yet?  If not, what about writing one?

Regards,
Isaac.



More information about the Python-list mailing list