How to reload python module imported using `from module import *`

前端 未结 8 2014
挽巷
挽巷 2020-12-02 14:12

I saw in this useful Q&A that one can use reload(whatever_module) or, in Python 3, imp.reload(whatever_module).

My question is, what if

8条回答
  •  孤街浪徒
    2020-12-02 14:44

    Never use import *; it destroys readability.

    Also, be aware that reloading modules is almost never useful. You can't predict what state your program will end up in after reloading a module, so it's a great way to get incomprehensible, unreproduceable bugs.

提交回复
热议问题