Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8985485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:20:26+00:00 2026-06-15T21:20:26+00:00

I think most people agree that trailing whitespace is not good practice. A lot

  • 0

I think most people agree that trailing whitespace is not good practice. A lot of editors will display it for you or automatically strip it out.

Consider this Python function as a simple example:

Whitespace Example Screenshot

The extra whitespace on lines 11 and 13 are wrong. What I’m wondering about is line 10. Should a blank line inside a control block that doesn’t change indentation have leading whitespace?

Most editors I’ve used will keep the cursor at the indentation level from the preceding line, so making a blank line without leading whitespace takes some extra formatting. What’s the best practice? Should line 10 have leading whitespace or not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:20:28+00:00Added an answer on June 15, 2026 at 9:20 pm

    I’ll try to answer your question sticking to your Python example, quoting their style guide.

    From PEP-8:

    Method definitions inside a class are separated by a single blank line.

    From Wikipedia (blank line):

    A blank line usually refers to a line containing zero characters (not counting any end-of-line characters); though it may also refer to any line that does not contain any visible characters (consisting only of whitespace).

    If you believe the Wikipedia definition, you might ask why zero characters is preferred.

    For one it’s simpler, even if autoindent is turned on in your editor, you’re just filling your file with extra bytes for no good reason.

    Second, a regex for a zero character blank line is simpler as well, ‘^$’ usually vs something like ‘^\s*$’.

    As other answers have pointed out, it makes no difference execution wise to put in whitespace. With no good reason to do so, I would say the best practice is to leave it out and keep it simple. Can you imagine a situation where a zero character line would be treated differently than a line with some whitespace? I would hate to program in that language. Putting in whitespace seems baroque to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think most of us agree that it's a good idea to use a
I think most people agree that complying with W3C standards is a worthwhile pursuit.
I think I probably know that the most common suggestion will be change the
I think that I'm probably not writing lazily instantiated methods/attributes in the most ruby
It recently occurred to me that I (and I think most people) learned computer
I think most people know how to do this via the GUI (right click
I think most people here understand the importance of fully automated builds. The problem
I recently learned about Java's security model. Most people think Java is secure because
Why do most people say that data services and the database are the most
As I think most people know already, or if you don't, FPDF released a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.