3 ms·
With `reload(module)` you don't even have to restart the server if you structure it properly. Think server.py and server_handlers.py, where server.py contains
by qwertox 3y ago
With `reload(module)` you don't even have to restart the server if you structure it properly.
Think server.py and server_handlers.py, where server.py contains logic to detect a modification of server_handlers.py (like via inotify) and the base handlers which then call the "modifiable" handlers in server_handlers.py.
This is not limited to servers (anything that loops or reacts to events) and can be nested multiple levels deep and is among the top 3 reasons of why i use Python.
Reloading is instantaneous and can gracefully handle errors in the file (just print an err messge or stack trace and keep running the old code)