[Beginner] delete items of [] also from memory

Peter peter.mosley at talk21.com
Mon Nov 22 18:33:31 CET 2004


"Birgit Rahm" <br_y at yahoo.de> wrote in message news:<cns50t$5ip$05$1 at news.t-online.com>...
> Hello newsgroup,
> 
> I am a beginner, so I am asking maybe immoderate questions.
> I want to delete a [] variable, after filling it with complex objects. How
> should I do it?
> e.g.
> AAA = []
> AAA = [B, C, D, E, F]
> Can I
> 1) AAA = []
> 2) del AAA[0:]
> 3) ?
> whats about the computers memory, will it get free? Or will it get more and
> more while Python is running?

I too am a novice, so am prepared to be corrected if this is wrong.

I don't think you need to worry - Python handles memory allocation
automatically.  Names are not specifically allocated to memory, and
when the last reference to a name is deleted all the associated memory
is freed.



More information about the Python-list mailing list