question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New line creates whitespaces that conflict with PEP 8

See original GitHub issue

Issue 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 (or pip, 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?

  1. Open a new file
  2. Create an indentation, e.g. using an if 3 .Add some code
  3. 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:closed
  • Created 5 years ago
  • Comments:20 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
bcolsencommented, Feb 13, 2019

you wouldn’t be able to add any whitespace at all

Yeah I thought that sounded too easy.

0reactions
CAM-Gerlachcommented, Feb 19, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found