First time here? Check out the FAQ!
1

Is there a way to compile or check for errors without running

I know that Python is not a compiled language, but I was wondering if there is a way I can check my program for any errors without running it. Kind of like compiling a program before you run it.

Thanks

357mag's avatar
51
357mag
asked 2023-05-01 13:57:20 -0600
Wingware Support's avatar
4k
Wingware Support
updated 2023-05-01 14:04:21 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

I'm a little confused. I just wrote this little code snippet:

for x in range(2, 13): print(x);

It's correct except for the semicolon I placed in the second line.

Wingware Pro showed no warning, nothing wrong at all.

It even printed the numbers 2 through 12.

Wouldn't placing a semicolon at the end of a line be a sytax error?

Oh...I just found out that Python does allow semicolons but they do nothing I guess.

357mag's avatar
51
357mag
answered 2023-05-01 16:07:51 -0600, updated 2023-05-01 16:14:33 -0600
edit flag offensive 0 remove flag delete link

Comments

Yes, for reasons lost in the mists of ancient Python history, it does allow semi-colons optionally at the end of a line or as a way to put multiple lines of code on the same physical line. I don't think this is done very often, and I'm not sure if third party code checkers like flake8 and pylint would even look for this. Wing's builtin checker doesn't, but then it only focuses on a relatively small subset of errors.

Wingware Support's avatar Wingware Support (2023-05-01 21:43:43 -0600) edit
add a comment see more comments
0

Wing Pro has the Code Warnings tool that will do this. There are some built-in checks for common errors, and you can also configure this to use flake8, mypy, pep8, and pylint (or any combination thereof). The documentation for this capability is here: https://wingware.com/doc/warnings

Wingware Support's avatar
4k
Wingware Support
answered 2023-05-01 14:03:51 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer