[wplug] Indenting to control block structure [was: RE: first language]

bgtrio at yahoo.com bgtrio at yahoo.com
Wed Apr 2 08:15:06 EST 2003


Well, in practice, programmers are smarter than this.  They know 
whitespace is important so they manage it. When you know you're going to 
be editing python, you use an editor that  properly handles tabs: again, 
you don't use Microsoft Word to edit C  code, and you don't use an editor 
that doesn't give you spaces for tabs in python.

While braces are unambiguous, indentation that differs from your own style 
can mislead you into thinking that you're in one code block when you're in 
another.  The difference is this: Python standardizes the indentation 
style to eliminate this kind of confusion; C and other whitespace-agnostic 
languages let you give any sort of incorrect hint you like.

I've done python projects with around 6 people and never had trouble of 
this sort that I can recall.  And if there was ever a question, you can 
just run the tab nanny script on a source tree to convert all the tab 
characters to spaces.

Bryguy


On Tue, 1 Apr 2003, Dave Neuer wrote:

> The thing that's always bothered me about languages
> which attach syntatic significance to whitespace is
> purely theoretical: what happens when you have a large
> team of programmers working on the same source files
> w/ different editors, perhaps on different platforms,
> and differences in formatting which aren't visually
> apparent occur?
> 
> For instance, on Unix a tab is 8 spaces. What if
> someone else on a different platform edits the same
> file (and say for the sake of argument that their
> platform uses a width of 4 spaces to indent tab
> characters and their own editor preference is set to
> indent by 4 space characters -- not a tab).
> 
> What happens when someone goes to execute this code?
> Will the interpreter bail because one line starts w/ a
> tab and the other 4 spaces? How will person #2 fix the
> error when they can't visually recognize the cause?
> 
> The nice thing about braces (or any other
> non-whitespace delimiter like parens) is they are
> *visually* unambiguous. Whitespace is *visually*
> ambigous.
> 
> For people programming alone it's obviously not an
> issue (and like I said I'm not sure it's even ever
> practically been an issue for teams).
> 
> Dave
> 
> --- Tom Moertel <tom at moertel.com> wrote:
> > On Tue, 2003-04-01 at 11:21, Weber, Larry A wrote:
> > 
> > > I can't tolerate a language that is whitespace
> > dependent.  Python uses
> > > indentation instead of brackets.
> > 
> > Don't knock it until you have spent a few months
> > using it.
> > 
> > I'm a big fan of the Haskell programming language,
> > which lets you use
> > either layout (indentation) or brackets to define
> > logical blocks.  After
> > a few months of coding in Haskell, I now use
> > layout-based blocks almost
> > exclusively.  I've tried it both ways, and for me
> > the choice is
> > obvious.  Layout-based blocks improve the S/N ratio,
> > eliminate clutter
> > and redundancy, and give programmers better control
> > over vertical white
> > space, which when used wisely makes code more
> > understandable.
> > 
> > In fact, I like layout-based blocks so well, I
> > brought them to Perl:
> > 
> >    
> > http://www.kuro5hin.org/story/2003/3/18/235625/457
> > 
> > So, don't write them off until you have given them a
> > good, long try. 
> > You might discover that you have been missing
> > something good.
> > 
> > Cheers,
> > Tom
> > 
> > 
> > _______________________________________________
> > wplug mailing list
> > wplug at wplug.org
> > http://www.wplug.org/mailman/listinfo/wplug
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online, calculators, forms, and more
> http://platinum.yahoo.com
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
> 




More information about the wplug mailing list