2

Is there anything that allows visual studio code to tell you if you are writing python code that is not compatible with both python 2 and 3 versions? I know that PyCharm has this feature but I'd prefer not to switch between IDEs depending on the language I'm coding in.

For example, print "Hello world!" should give me an error because its not compatible with python 3. assert 3 / 2 == 1.5 should give me an error because it's not compatible with python 2.

2
  • The first one should already be caught in Python 3 mode, because it's a syntax error. You can catch a lot more things by installing and configuring one or more linters. But I don't think any of the common linters or static analyzers will catch the invalid assert—they won't even catch assert 3 == 2. Commented May 3, 2018 at 2:15
  • I wonder how PyCharm does it then... Commented May 3, 2018 at 2:30

1 Answer 1

1

If you set up linting in the Python extension and then set up Pylint to run with --py3k turned on then you will get warnings about Python 2/3 compatibility.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.