Detecting circular imports

后端 未结 4 1224
情歌与酒
情歌与酒 2021-01-01 15:01

I\'m working with a project that contains about 30 unique modules. It wasn\'t designed too well, so it\'s common that I create circular imports when adding some new function

4条回答
  •  無奈伤痛
    2021-01-01 15:24

    import uses __builtin__.__import__(), so if you monkeypatch that then every import everywhere will pick up the changes. Note that a circular import is not necessarily a problem though.

提交回复
热议问题