You have: def _check_interval(self, interval): if not type(interval) in [int, float]: raise TypeError('{} is not numeric'.format(interval))
This check is better written: if not isinstance(interval, (int,float)): which handles subclasses of these types (but note that bool subclasses int :-) normally we don't care), or behaviourally: try: interval = float(interval) except ValueError as e: raise TypeError( "cannot convert %s:%r to float: %s" % (type(interval).__name__, interval, e)) from e which tries to convert to float and fails if that does not work, which supports classes with a __float__ method (these classes are rare, but decimal.Decimal is one example). I'd probably use the isinstance() form myself. Cheers, Cameron Simpson <c...@cskk.id.au> -- https://mail.python.org/mailman/listinfo/python-list