it does have its uses though oftenreplacing or adding methods at run time (called monkey-patchingis used in automated testing if testing client-server applicationwe may not want to actually connect to the server while testing the clientthis may result in accidental transfers of funds or embarrassing test -mails being sent to real people insteadwe can set up our test code to replace some of the key methods on the object that sends requests to the serverso it only records that the methods have been called monkey-patching can also be used to fix bugs or add features in third-party code that we are interacting withand does not behave quite the way we need it to it shouldhoweverbe applied sparinglyit' almost always "messy hacksometimesthoughit is the only way to adapt an existing library to suit our needs callable objects just as functions are objects that can have attributes set on themit is possible to create an object that can be called as though it were function any object can be made callable by simply giving it __call__ method that accepts the required arguments let' make our repeater classfrom the timer examplea little easier to use by making it callableclass repeaterdef __init__(self)self count def __call__(selftimer)format_time("{now}repeat { }"self countself count + timer call_after( selftimer timer(timer call_after( repeater()format_time("{now}starting"timer run(