Python vs Java garbage collection?
"Martin v. Löwis"
martin at v.loewis.de
Mon Dec 23 05:52:37 EST 2002
maney at pobox.com wrote:
>>People often extend this rationale to "your computer has infinite
>>resources". Closing a file is then not necessary since you can have as
>>many open files as you want to, and finalizers wouldn't be needed for that.
>
> However, this sort argument won't get you very far when the external
> resource is something like a write lock on a shared data store!
Indeed. That's why, a write lock shouldn't be released in a finalizer,
but in a explicit release operation. Finalizers are only good for
resources where your program would behave correctly if you had unlimited
supply and no finalizers would be called.
Regards,
Martin
More information about the Python-list
mailing list