Why Use Assertion

And, what is the difference between raising normal errors and assertions? Basically:

Raising ErrorAssertion
Raise ValueError('Input not in range [1, 10]')assert 1 <= v <= 10
Intended for usersIntended for developers
Happens when user action is illegalHappens when code contains bug
To signal to user to take a different course of actionTo easily find where code starts to error
Cannot and should not be disabledCan be disabled during compilation,
therefore should not be used in logics like data validation

Python, VSCode

Python + VSCode: “Go to Definition” Doesn’t Work?

Make sure that you have Microsoft’s Python extension installed. If you need more than one paths, simply create a .env file in project root path, and add extra paths in, separated by :, as such:


VSCode will know to look for definitions under these paths.

If it still doesn’t work, or doesn’t work all the time, it’s very likely that one of the other plugins that you have is interfering with the Python one. To check, use Command + Shift + P to open the prompt and run the command:

> Extensions: Open Extensions Folder

Move all the extensions there to another temporary place, re-install the Python extension, and see if things start working now. If it does work now, add them back in batch to find out the culprit. 😀

Also, for gigantic projects, try switching intellisense engine:

Try switching off Jedi