MSelectionList’s getDagPath method takes a 3rd optional argument of an MObject. This MObject will hold the selected components (if there are any, otherwise it will be null).
import maya.OpenMaya as om
sel = om.MSelectionList()
om.MGlobal.getActiveSelectionList(sel)
dag = om.MDagPath()
component = om.MObject()
sel.getDagPath(0, dag, component)
if not component.isNull():
# There were components selected
vert_itr = om.MItMeshVertex(dag, component)
while not vert_itr.isDone():
# Do stuff
vert_itr.next()