Waht do you think about my repeated_timer class
Cecil Westerhof
Cecil at decebal.nl
Wed Feb 2 21:17:07 EST 2022
Cameron Simpson <cs at cskk.id.au> writes:
> 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 :-)
Done, thanks.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
More information about the Python-list
mailing list