reading files
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Dec 20 17:47:46 EST 2005
In <868xuhoveu.fsf at bhuda.mired.org>, Mike Meyer wrote:
> Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
>> The text you read is still hanging around, waiting for you to use it. Once
>> you are done with it, you might want to reclaim that memory used,
>> especially if it is a 100MB text file:
>>
>> mytext = "" # re-bind the name 'mytext' to the empty string
>
> If you have no further use for the variable, then "del mytext" will
> also free up the memory, and make it clear to the reader that you're
> done with the memory.
It makes clear you're done with the *name* since that's what ``del``
deletes from the namespace, not the object. I know that you know this but
many people seem to think ``del`` get's rid of the object like a call to
`free()` in C.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list