[Tutor] Question about 'scopes'
alan.gauld@bt.com
alan.gauld@bt.com
Tue Mar 25 07:24:01 2003
> 'contain' parts. Hence a scope seems quite akin to a 'level'
> (as in a level of analysis) and comprises namespace references
> and definitions.
A namespace is a scope. They are synonymous.
The best illustration for namespaces that I know is that off
an office block. It has lots of teams of people in different
offices. Several of the people will have the same first name.
Within their own office or team they will be referred to as
Joe, Mary etc. But when referring to another team member of
the same name we clarify things by saying "Joe from accounts"
or Mary from Marketing". Thus the team is a namespace.
Similarly in Ptython a namespace is simply a locality within
the program within which a given name is valid. Outsider that
locality the namespace must be used to prefix the name.
Because namespaces work differently in different programming
languages it is impossible to give a single definitive
description that covers all the options. You might like to take
a peek at my namespaces topic in my online tutror too...
Alan g.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld/