Learn to move object from python in blender 2.5

hi there...
this is my first post in this personal learning log and this time i want to log my experience on learning a python script inside blender 2.58.

What i want to know?
What i want to learn is how do we move object in blender using a python script. To learn this i use the default scene from blender.

In blender default scene, we have one Cube object, one camera and one pointlight. The object i'm trying to move using python script is the Cube and i want to move it 2 units in X axis.






What did i do?
I found out two ways to move the Cube 2 units in X axis.

  1. Select the Cube and in the python console i write :

    bpy.ops.transform.translate(value=(2.0, 0, 0))

  2. In the python console i can also write:

    bpy.data.objects['Cube'].position = (2.0, 0, 0)

conclusion:
I learn that there're at least two ways to To move object in blender using python script. First we use ops (maybe this stand for operations) then use the transform function. Second we can also change the actual data of the object inside bpy.data.objects[]