Why no open(f, "w").write()?
Isaac To
kkto at csis.hku.hk
Wed May 29 22:57:30 EDT 2002
>>>>> "Kragen" == Kragen Sitaker <kragen at pobox.com> writes:
Kragen> "Delaney, Timothy" <tdelaney at avaya.com> writes:
>> You should never rely on automatic freeing of *any* resources unless
>> it is guaranteed. Always explicitly free resources when you have
>> finished with them.
Kragen> You mean, assume you have no garbage collector? If I had to do
Kragen> that, my Python code would get a *lot* more complex.
Garbage collection is for collecting memory. So for memory matters, you can
(and actually, must) give up the control to the garbage collector. For
anything else, you *must* do it explicitly. Surely you shouldn't lock a
mutex and remove the reference to the mutex, hoping that the garbage
collector will unlock it quickly enough.
Regards,
Isaac.
More information about the Python-list
mailing list