Y
Hacker News
new
|
ask
|
show
|
jobs
by
benhoyt
389 days ago
Yeah, I use this sometimes too (even though Python makes "monkey patching" easy). However, note that it's simpler and clearer to use a default value for the argument:
def do_foo(sleep=time.sleep): for _ in range(10): sleep(1)