New line creates whitespaces that conflict with PEP 8
See original GitHub issueIssue Report Checklist
- [ x ] Searched the issues page for similar reports
- [ x ] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
- [ x ] Reproduced the issue after updating with
conda update spyder
(orpip
, if not using Anaconda) - [ x ] Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
When creating a new line by return
in an indented environment, spyder makes whitespaces to keep the indentation. However, when subsequently keeping the line empty by pressing return
again, those whitespaces make a PEP 8 warning .
What steps reproduce the problem?
- Open a new file
- Create an indentation, e.g. using an
if
3 .Add some code - Have a blank line by double tapping return and then some more code
What is the expected output? What do you see instead?
A PEP8 warning occurs with whitespaces in blank line. My suggestion would be to catch if a line is intentionally blank and then remove the whitespaces needed for indentation. However, when the user decide to add code, the whitespaces have to be added manually to be on the right indentation which may be tedious.
Issue Analytics
- State:
- Created 5 years ago
- Comments:20 (19 by maintainers)
Top Results From Across the Web
PEP 8 – Style Guide for Python Code
Use 4 spaces per indentation level. Continuation lines should align wrapped elements either vertically using Python's implicit line joining ...
Read more >coding style - Pep8 Python3.3 Contradiction
Python accepts the control-L (i.e. ^L) form feed character as whitespace; Many tools treat these characters as page separators, so you may use ......
Read more >How to Write Beautiful Python Code With PEP 8
Learn how to write high-quality, readable code by using the Python style guidelines laid out in PEP 8. Following these guidelines helps you...
Read more >An Overview of The PEP 8 Style Guide | by Dan Root
Do not use excessive whitespace in your expressions and statements. You should have blank spaces after commas, colons, and semi-colons if it isn ......
Read more >How To Write Beautiful Python Code With PEP 8
Blank lines are also called vertical whitespaces. It is a logical line consisting of spaces, tabs, formfeeds or comments that are basically ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah I thought that sounded too easy.
@bcolsen Okay, that makes sense. I always use
<br>
in Markdown personally, but its best to air on the side of caution when modifying what the user inputs by default.