The Artima Developer Community
Sponsored Link

Weblogs Forum
Stricter Whitespace Enforcement

25 replies on 2 pages. Most recent reply: Jul 12, 2007 2:25 AM by Vincent O'Sullivan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 25 replies on 2 pages [ « | 1 2 ]
Jesse Wiles

Posts: 2
Nickname: jwiles
Registered: Apr, 2005

Re: Stricter Whitespace Enforcement Posted: Apr 20, 2005 6:43 AM
Reply to this message Reply
Advertisement
Guido van Rossum wrote:
All code indented with four spaces. This will also get rid of the tabs problem!

I would prefer an algorithm that enforces consistency, rather than a hard, fast number. Personally, I'm a 2 spaces guy. All code I write everywhere gets 2 indent spaces.

Hooray for no more tabs, and horray for enforcing space after commas and semi-colons.

Jesse Wiles

Posts: 2
Nickname: jwiles
Registered: Apr, 2005

Re: Stricter Whitespace Enforcement Posted: Apr 20, 2005 6:45 AM
Reply to this message Reply
oops. must read more before opening big mouth...

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Stricter Whitespace Enforcement Posted: Apr 20, 2005 8:04 AM
Reply to this message Reply
> oops. must read more before opening big mouth...

Way to go Guido! Still reelin' 'em in three weeks after April 1! :)

Stan Bernsteen

Posts: 1
Nickname: sbernste
Registered: May, 2005

Re: Stricter Whitespace Enforcement Posted: May 11, 2005 7:16 AM
Reply to this message Reply
Does anybody have a script to reformat poorly-formatted programs to conform to these standards?

Guido van van Rossum

Posts: 359
Nickname: guido
Registered: Apr, 2003

Re: Stricter Whitespace Enforcement Posted: May 11, 2005 7:47 AM
Reply to this message Reply
> Does anybody have a script to reformat poorly-formatted
> programs to conform to these standards?

The indent.py scrip in the Tools/scripts directory in the Python source tree does a good job of making indentation uniform.

I'm not aware of any tool that reformats expressions according to my preferred style.

Michael P. Soulier

Posts: 5
Nickname: heisen
Registered: Sep, 2004

Re: Stricter Whitespace Enforcement Posted: May 15, 2005 8:00 AM
Reply to this message Reply
Seems a tad draconian to me.

I love Python, but I'm not sure I'm going to want to go on using it if you're going to tell me how to format my code down to the last character.

x*y + a*b

is a matter of personal taste. I find this line without whitespace to be crowded and hard to read. I also like to put whitespace in parens at times to keep things readable.

I think you're going way too far here. If you make Python an annoyance to use, I'll have to use something else. This just seems too fanatical to me.

Michael P. Soulier

Posts: 5
Nickname: heisen
Registered: Sep, 2004

Re: Stricter Whitespace Enforcement Posted: May 15, 2005 8:08 AM
Reply to this message Reply
Y'know, this becomes much more plausible when you don't read it until May, and your RSS reader lies to you about the date of the posting. :)

*sigh*

Mind you, the dropping tabs thing would be cool.

Robert Konigsberg

Posts: 6
Nickname: konigsberg
Registered: Feb, 2005

Re: Stricter Whitespace Enforcement Posted: Aug 27, 2005 6:13 AM
Reply to this message Reply
I must confess having read this five months later I didn't know it was a prank! Nice one.

Claudio Grondi

Posts: 2
Nickname: grondi
Registered: Jul, 2005

Re: Stricter Whitespace Enforcement Posted: Dec 2, 2005 6:05 PM
Reply to this message Reply
I see quite clear, that a tool which can be configured to fit own needs and which can re-format 'alien' code exactly to the form defined in the own configuration file would be of great value. Adding restrictions of any kind instead is in my eyes the wrong way to go.

The main purpose of a programming language is from my narrow personal point of view to help the programmer to write programs. Imposing any restrictions is in my eyes counter productive if it does not help to save time and efforts during programming of _own_ projects.

Replacing this goal with the goal of _maybe_ helping the software engineer to manage large projects won't help much the individual programmer to put his own code together. So it is the question of philosophy behind the efforts to improve a programming language. Should it be a tool for the very smart individual working on achieving own programming goals or for a bulk of programmers managed by a chief programmer in some large projects?
I consider it impossible, or at least very hard, to go for both goals at the same time.

Down to the personal and subject related details:
If I had to use four spaces for indentation and can't spread code over multilines between brackets, then Python won't be for me as valuable as it is now.
The only thing I would be happy about is to abandon tabs, just because they violate the WYSIWYG rule.

The intuitivly possible should be made possible.
Well and wise designed helper tools should be added.

But dicussing of number of spaces for indentation or allowed before or after any other symbols is in my eyes waste of time or evidence, that the really cool ideas for further progress cease to drive the further development of Python.

Claudio

Paolo Furlani

Posts: 1
Nickname: pavlik
Registered: Jul, 2007

Re: Stricter Whitespace Enforcement Posted: Jul 11, 2007 8:08 AM
Reply to this message Reply
Why "dropping tabs thing would be cool"?
Every editor can manage it (vi, idle, emacs, etc).
You prefer 2 spaces indent ":set ts=2", 4 spaces indent ":set ts=4", and so on...
You have a source 3 spaces indented: ":%s=^ =^I=" and ":%s=^I =^I^I=g".
What's the problem?
You can set your indentation preferences the way you like.

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Stricter Whitespace Enforcement Posted: Jul 12, 2007 2:25 AM
Reply to this message Reply
Using tabs for indents only works if only tabs are used for all indents. In reality, where tabs then they are only used partially along with spaces. When that happens then 'personalising' the size of someone else's tabs is useless and resizing the tabs to suit every author is pointless.

A better solution, that I've used on several occasions, is - when you check out someone else's code - to clean up the white space (tabs -> spaces, delete trailing spaces, run auto-indent) and check the code in again before working on it.

So yes; No tabs is cool.

Flat View: This topic has 25 replies on 2 pages [ « | 1  2 ]
Topic: Stricter Whitespace Enforcement Previous Topic   Next Topic Topic: The Flex & Air Jam

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use