Vertex count appears incorrect after removing doubles
With the standard API (bpy), the editmesh is flushed to mesh when you change mode. What you access is the mesh, which is still in the old state as it was when you entered editmode. What you want is the editmesh's vertex count, but you can't directly access it with bpy.

You could change mode to flush changes, but there's actually a better way in recent Blender versions:

# Load the objects edit-mode data into the object data
bpy.context.object.update_from_editmode()


If you work with the BMesh Module (bmesh) and a wrapped bmesh, the number of vertices will be immediately updated - but you may still need to flush changes from bmesh to mesh after adding/removing geometry or Blender will crash:

import bpy
import bmesh

me = bpy.context.object.data
bm = bmesh.from_edit_mesh(me)

print(len(bm.verts)) # 8 (in case of cube)

bm.verts.remove(bm.verts[0])

print(len(bm.verts)) # 7

bmesh.update_edit_mesh(me)