does python have useless destructors?

Brian van den Broek bvande at po-box.mcgill.ca
Fri Jun 11 11:59:32 EDT 2004


Terry Reedy said unto the world upon 11/06/2004 11:31:

> "Brian van den Broek" <bvande at po-box.mcgill.ca> wrote in message
> news:40C9C2F2.1020201 at po-box.mcgill.ca...
> 
>>>>>myfile = open("myfilepath", "w")
>>>>>myfile.write(reallybigbuffer)
>>>>>myfile.close()
> 
> 
>>>>... immediately raises a warning flag in the mind of an
>>>>experienced Python programmer.
>>>
>>>Depends on the circumstance, I'd think.
> 
> 
>>  From that standpoint, I am wondering why the code that Michael P.
>>Soulier provided above would worry an experienced Python programmer.
> 
> 
> A reallybigbuffer might not fit on the hard disk, in which case writing
> would raise an exception that it not caught.  For an application intended

<Helpful details SNIP'ed>

> 
> Terry J. Reedy

Thanks Terry!

Best,

Brian vdB





More information about the Python-list mailing list