I am learning perl and python... at the same time, not my by design but it has to be done.
Question:
In a perl script I use(see below) at the head of my txt.
Not a compile-time error, but Python has many linters that can identify the same type of errors as Perl's "use strict":
Consider a Python file named tmp.py
with:
def foo():
a = 1
b = 2
return a
flake8 tmp.py
will return:
tmp.py:13:5: F841 local variable 'b' is assigned to but never used
In addition to flake8
, check out mypy
for more advanced type checking and pylint
to enforce certain coding styles. As with any programming language, nothing prevents you from using multiple linters on your codebase -- in fact it's encouraged as each linter has a different focus.