8.5 gold, you may have to do something like this if I remember correctly. (but I could be way off)
###############
import maya.cmds as cmds
def warn():
height = cmds.getAttr( 'mySphere.ty' )
if height > 10.0:
print 'Sphere is too high!'
cmds.sphere(n = 'mySphere')
cmds.scriptJob (attributeChange =('mySphere.ty','python("warn()")'))
#################
8.5sp01 or later
#############
import maya.cmds as cmds
def warn():
height = cmds.getAttr( 'mySphere.ty' )
if height > 10.0:
print 'Sphere is too high!'
cmds.sphere(n = 'mySphere')
cmds.scriptJob (attributeChange =('mySphere.ty',warn))
########
that last line might need to be, or could be just as valid as above...
##########
cmds.scriptJob (attributeChange =('mySphere.ty','warn()'))
#########
the trick here may just be realizing that you are passing a tuple consisting of the attribute you are watching and the function you want called, into the attributeChange flag