1 Namespace Definition
2 ====================
3
4 Module attributes are defined either at the module level or by global
5 statements.
6
7 Class attributes are defined only within class statements.
8
9 Instance attributes are defined only by assignments to attributes of self
10 within __init__ methods.
11
12 (These restrictions apply because such attributes are thus explicitly
13 declared. Module and class attributes can also be finalised in this way in
14 order to permit certain optimisations.)
15
16 Potential Restrictions
17 ----------------------
18
19 Names of classes and functions could be restricted to only refer to those
20 objects within the same namespace. If redefinition were to occur, or if
21 multiple possibilities were present, these restrictions could be moderated as
22 follows:
23
24 * Classes assigned to the same name could provide the union of their
25 attributes. This would, however, cause a potential collision of attribute
26 definitions such as methods.
27
28 * Functions, if they share compatible signatures, could share parameter list
29 definitions.
30
31 It is easier, however, to regard multiply defined classes and functions as
32 non-constant and to either disallow optimisations or to actually prevent the
33 program describing them from compiling.