Select vertices of mesh in python What is the python way to select vertices of a mesh?

I've tried:

for vert in obj.data.vertices:  
    vert.select = True


I ran the above code in edit mode, but the vertices didn't turn yellow.
import bpy,bmesh

ob   = bpy.data.objects['Cube']
mesh = bmesh.from_edit_mesh(ob.data)
for v in mesh.verts:
    v.select = True

# trigger viewport update
bpy.context.scene.objects.active = bpy.context.scene.objects.active


Docs