If a failure occurs, why not throw an exception?
You can, of course, return (-1, -1) as a failure, but that would not be a good solution, in my opinion.
Remember that in Python EAFP (easier to ask for forgiveness than permission) is preferable to LBYL (see before jumping).
, , , .
def myFunc(self):
if self.validate() != 0:
raise CustomNotValidatedException()
x,y = self.getXY()
return x,y
:
, getXY() .