I am currently working on python and I just met a case which I find hard to understand:
Instance1 = class1 ()
Instance2 = Instance1.class2 ()
I adapted the trick (in fact it comes from panda 3D)
My question:
The 2nd row can really exist, if yes what is it (I do not understand the "Instance1.class2 ()")
I specify my problem a little, giving you the original in Panda 3D
Code:
# Load the panda actor, and loop its animation
pandaActor = Actor.Actor("models/panda-model",{"walk":"models/panda-walk4"})
pandaActor.setScale (0.005,0.005,0.005)
pandaActor.reparentTo (render)
pandaActor.loop ("walk")
#Create the four lerp intervals needed to walk back and forth
pandaPosInterval1= pandaActor.posInterval(13,Point3(0,-10,0), startPos=Point3(0,10,0))
pandaPosInterval2= pandaActor.posInterval(13,Point3(0,10,0), startPos=Point3(0,-10,0))
pandaHprInterval1= pandaActor.hprInterval(3,Point3(180,0,0), startHpr=Point3(0,0,0))
pandaHprInterval2= pandaActor.hprInterval(3,Point3(0,0,0), startHpr=Point3(180,0,0))
Actor is a class, so pandaActor is an instance of this class (line 2)
What I can not understand is:
pandaPosInterval1 = pandaActor.posInterval (........)
posInterval is also a class, I do not therefore: pandaActor.posInterval (........)
Practically, this I have no problem, I understand the trick, but at the theoretical level (pure Python), I do not know what this is.
Bookmarks