python - Trying to understand classes -


given code following:

    class a():         x=1         class b()         x=3     print x 

how value of x in class b used in class a?

i example this:

    class a:         def add():             x=1                  class b:                    def addmore():                     y=1   

how can value of y in class a

if understood right code, , access x variable:

class a():     x=1     class b():         x=3  ainstance = a() print ainstance.x '1' print ainstance.b.x '3' 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -