On Fri, Jun 3, 2011 at 2:23 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: >> You can't get a valid result from data produced by an invalid >> computation. Garbage in, garbage out. > > Of course you can. Here's a trivial example: > > def f(x): > return 1 >
If your incoming x is garbage, your outgoing 1 is also garbage. Later on, you can use 'isgarbage(x)' to find out whether anything went wrong. You can also use 'isinsane(self)', which is defined as follows: class Programmer: def isinsane(self): return True if float("nan")==float("nan") else True Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list