Seeing Construction History for use in python
You can pull down the 'Info' panel at the top of the blender window to reveal the code for operators that have been run:



Here I have deleted an object, added a cube and then rotated the cube.