Jan-28-2019, 05:20 AM (This post was last modified: Jan-28-2019, 05:20 AM by Qui_Ten.) PEP8 is automatically formatting a part of my code, I was just learning about lambdas and I had a 2 line code like this: My simple code: (2 lines) What PEP 8 does: (4 lines) it may not seem like a lot, but it went from 2 lines to 4 lines, with the huge possibility of it being a 6 line code (if I had anything above the def function, it would add another 2 lines between them.) If the def had anything above: (6 lines) So it can easily go from 2 lines to 6 lines! How do I disable this function specifically for lambdas? Jan-28-2019, 08:17 AM (This post was last modified: Jan-28-2019, 08:17 AM by buran.) It's not PEP8 that format your code, but the linter extension you have installed (there are several, so it's not clear which one you use - probably the one with same name?). The purpose of linter is to make your code conform with PEP8 recommendations. How strict it will be depends on your particular settings - this is to answer the question how you can disable. Now, in this particular case PEP8 has clear recommendation: Quote:Always use a def statement instead of an assignment statement that binds a lambda expression directly to an identifier. If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs |
Set PyLint command-line options. The command-line options section of the PyLint documentation describes how to control PyLint's behavior through a.pylintrc configuration file. Such a file can be placed in the root of a Python project in Visual Studio or elsewhere depending on how widely you want those settings applied (see the command-line options for details). Installing and Configuring Visual Studio Code for Python Development. Installing Visual Studio Code is very accessible on any platform. Full instructions for Windows, Mac, and Linux are available, and the editor is updated monthly with new features and bug fixes. You can find everything at the Visual Studio Code website. In case you were wondering, Visual Studio Code (or VS Code for short.

| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| Noob warning: trying to use pip to install pytest and pep8 in Command Prompt | adifrank | 4 | 465 | Dec-20-2020, 04:23 AM Last Post: adifrank | |
| Visual Studio Code help | aaronrousch | 2 | 696 | Aug-04-2020, 10:34 AM Last Post: snippsat | |
| Problems on 'no such file or directory' in python on Visual studio 2019 | 504416430 | 1 | 1,071 | Aug-02-2020, 08:38 PM Last Post: Larz60+ | |
| Visual Studio-remove Output clutter | mds | 14 | 2,200 | Jun-04-2020, 11:47 PM Last Post: mds | |
| Type hinting style and PEP8 | hlovatt | 2 | 693 | May-07-2020, 08:12 PM Last Post: hlovatt | |
| Issue with code for auto checkout | nqk28703 | 2 | 785 | Nov-01-2019, 09:33 AM Last Post: nqk28703 | |
| Variable comments on Visual Studio Code | sal | 2 | 878 | Oct-19-2019, 02:13 PM Last Post: sal | |
| Visual Studio Python 2.2 Source Project | bobosamma | 5 | 941 | Oct-14-2019, 11:19 AM Last Post: snippsat | |
| In Visual Studio Python is not properly installed | jalea148 | 4 | 992 | Sep-26-2019, 12:31 PM Last Post: snippsat | |
| run into issues while configuring visual-studio code on a win 7 machine. | apollo | 3 | 1,367 | Sep-12-2019, 12:25 AM Last Post: snippsat | |
Vscode Python Pep8
Vscode Autopep8 Args
Default Formatter
Code formatting is supported using either one of yapf or autopep8.
The default code format provider is autopep8.
Auto Formatting
Formatting the source code as and when you save the contents of the file is supported.
Enabling this requires configuring the setting 'editor.formatOnSave': true as identified here.
Paths
All samples provided here are for windows.
However Mac/Linux paths are also supported.
AutoPep8
You can configure the format provider by changing a setting in the User or Workspace settings file as follows:
Installing autopep8
Custom Path
This is generally unnecessary. As the Extension will resolve the path to the formatter based on Python executable being used or configured in python.pythonPath of settings.json. If this cannot be found, then the formatter will be resolved based on the current environment Path settings.
If this is not the case or you wish to use another version of autopep8, all you need to do is configure the path as follows either in the User or Workspace settings file:

Yapf
You can configure the format provider by changing a setting in the User or Workspace settings file as follows:
Custom Path
This is generally unnecessary. As the Extension will resolve the path to the formatter based on Python executable being used or configured in python.pythonPath of settings.json. If this cannot be found, then the formatter will be resolved based on the current environment Path settings.
Pylint Pep8
If this is not the case or you wish to use another version of yapf, all you need to do is configure the path as follows either in the User or Workspace settings file:
Vscode Pep8 Check
Custom arguments to Yapf
Vscode Pep8 Linter
Custom arguments can be passed into yaps by configuring the settings in the User or Workspace settings as follows:
Installing Yapf
pip install yapf
