[Tutor] Variable reference

Alan Gauld alan.gauld at btinternet.com
Mon Jul 6 22:44:38 CEST 2015


On 06/07/15 14:55, Suresh Nagulavancha wrote:
> Hello everyone
> I want to know about the variables dereference
> Code is in python 27
> Let my variable be
> foo="hello python"
> Print foo
> del foo
> What del command here actually doing

Python variables are stored internally in a dictionary.
del removes the name/value pair from the dictionary.

If there are no more references to the object then the
garbage collector will eventually remove it from
memory. But you shouldn't need to worry too much
about that.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list