- Mokey patch is to replace the so-called run-time
- For example gevent libraries need to modify the built-in socket
- from gevent import monkey; mokey.patch_socket () so put socket built obstruction replaced nonblocking socket
Look at the code
import socket print(socket.socket) print("After monkey patch") from gevent import monkey monkey.patch_socket() print(socket.socket()) import select print(select.select) monkey.patch_select() print("After monkey patch") print(select.select) import time print(time.time()) def _time(): return 1234 time.time = _time Print (time.time ()) # This realization of the running to replace the so-called monkey patch