Getting global axis value of the vertex with the lowest value In Python, Is there an operator that selects the vertex (or vertices if applies) that has the lowest value on a global axis (let's say Z). 
I have an object that I need to select it's bottom vertex/vertices (the ones with the lowest Z global value) using Python, in order to move it's origin to the Median point among these vertices later.
I'm a noob when it comes to python but won't this do the job?

import bpy
import bmesh 

object = bpy.data.scenes[0].objects["Cube"].data
vcount = len(object.vertices)
cube = bmesh.from_edit_mesh(object)

if (vcount &gt; 0):
    lowest = cube.verts[0]
    for i in range(vcount):
        if (lowest.co.z &gt; cube.verts[i].co.z):
            lowest = cube.verts[i]

    for v in cube.verts:
        if (v.co.z == lowest.co.z):
            v.select = True
        else:
            v.select = False
bmesh.update_edit_mesh(object, True)