Is there a need for a “use strict” Python compiler?

后端 未结 10 2346
眼角桃花
眼角桃花 2021-02-03 21:26

There exist static analysis tools for Python, but compile time checks tend to be diametrically opposed to the run-time binding philosophy that Python embraces. It\'s possibl

10条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-03 22:14

    I've found that I only really care about detecting references to undeclared vars. Eclipse has pylint integration via PyDev and, although pylint is far from perfect, it does a reasonable job at that.

    It does kind of go against Python's dynamic nature, and I do have to add #IGNOREs occasionally, when my code gets clever about something. But I find that happens infrequently enough that I'm happy with it.

    But I could see the utility of some pylint-like functionality becoming available in the form of a command-line flag. Kind of like Python 2.6's -3 switch, which identifies points of incompatibility between Python 2.x and 3.x code.

提交回复
热议问题