The behavior you see is exactly what you should expect. When you define a class
>>> class Foo(object): pass
...
, , - - , Foo. , , :
>>> Foo.a = 1
>>> Foo.a
1
, class .
, (, ), . , : . , , , , . ,
>>> class Foo(object):
... class Bar(object): pass
...
Foo , Bar, . , Foo Bar . (, , :
>>> class Foo(object):
... class Bar(object): pass
...
>>> class Foo(object): pass
...
>>> class Bar(object): pass
...
>>> Foo.Bar = Bar
.)
! , , ; !
, , , , .
- , . , . , , (). , ( ?) , .
- , . , , . - Page, , , contents , Page, , contents,
, Child1.Subcls.a Child2.Subcls.a . , !
, Java Python? , , , ?
- , , , , , , . , , Python, : .