[Tutor] Fwd: Accessing variables from other modules

Alan Gauld alan.gauld at yahoo.co.uk
Wed Sep 5 19:13:11 EDT 2018


On 05/09/18 18:12, Chip Wachob wrote:

> In your examples name1 and name2 could be anything that is contained
> in that module.. a variable, function, class, etc..  correct?

Correct. They are just names.

Again a difference between Python and C.
In C a name is a label associated with a memory address
which in turn is associated with a specified data type.

In Python a name is just a name, a key in a dictionary.
It's value is any kind of object and can change throughout
the program's lifetime. A string now, an integer later,
then a list and maybe even a class or instance. Of course,
it's probably not a good idea to change a variables type
too often but it is possible.


-- 
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