473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

do people really complain about significant whitespace?

Where are they-who-hate-us-for-our-whitespace? Are "they" really that
stupid/petty? Are "they" really out there at all? "They" almost sound
like a mythical caste of tasteless heathens that "we" have invented.
It just sounds like so much trivial nitpickery that it's hard to
believe it's as common as we've come to believe.

Aug 7 '06
56 3489
On Thu, 10 Aug 2006 04:01:51 -0700
Rob Wolfe <bl****@interia.plwrote:

# if x==1:
#
# the newline is inserted automatically when you type ":"? That's a
#>
#Exactly.

Really? The newline? I know it *indents* automatically. But it
definitely doesn't insert newline when I try it.

I even downloaded revision 4.63 and I really do not see any code for
doing that. py-electric-colon only seems to dedent code.

# functionality I would like to see, but it doesn't seem to work
# this way.
#>
#Here is fragment of my python-mode.el:

Please note that this comment doesn't say anything about automatically
inserting newlines, only about indenting (actually, dedenting) as
needed.

Anyway, this is probably becoming off-topic here.

--
Best wishes,
Slawomir Nowaczyk
( Sl***************@cs.lth.se )

Cursor: What you become when your computer crashes.

Aug 10 '06 #51
On 2006-08-10 07:40:01, Stephen Kellett wrote:
To answer your first question: In C++/Ruby/Pascal you'd have something
like this

function()
{
loop1()
{
[...]
}
}
I really dislike that the end of loop2 is implicit rather than
explicit.
Since in the above languages indentation is optional but you still use it
(and even may use a program that provides the correct indentation if the
coder didn't do it), what prevents you from adding optional end-markers in
Python? They are not required, but they are not forbidden either, very
similar to the indenting in the above languages. Something like this:

function()
loop1()
blah
blah

loop2()
blah

loop3()
blah
#end loop3()

blah3
#end loop2()
#end loop1()

otherloop()
blah
#end otherloop()
#end function()

Of course, few people will write like this, but it probably is easier to
write a Python code formatter that adds them than it is to write a C code
formatter that adds proper indentation and provides your preferred
placement of braces.

Gerhard

Aug 10 '06 #52

"Stephen Kellett" <sn***@objmedia.demon.co.ukwrote in message
news:AC**************@objmedia.demon.co.uk...
To answer your first question: In C++/Ruby/Pascal you'd have something
like this

function()
{
loop1()
{
blah
blah

loop2()
{
blah

loop3()
{
blah
}

blah
}
}

otherloop()
{
blah
}
}

and in Python that gets to

function()
loop1()
blah
blah

loop2()
blah

loop3()
blah

blah3

otherloop()
blah
Much nicer, IMHO ;-).
I really dislike that the end of loop2 is implicit rather than
explicit. If its implicit you have to look for it. And if blah3 didn't
exist then both loop2 and loop3 would be ending implicitly.
So add one of those judicious, informative comments that some have written
about in this thread ;-)
# end loop2
where 'loop2' would typically be something like 'i loop'. If blah3 didn't
exist, you could add
# end loop3
*above* the end loop2 comment.

I personally found matching far-apart well-indented braces visually
something of a nuisance too, so I sometimes did much the same in C:
} /* end i loop */
This problem gets worse with longer functions and more indentation.
And devoting lines to braces, including those that are visually interfering
(such as those for loop3) expands blocks and makes it more likely that
blocks will span screens. This makes the problem worse.
I'm sure some people are thinking the above is elegant.
Yes, allowing programmers to add explict end-suite markers only where
needed is, to me, more elegant that forcing redundant begin-suite markers
and often unneeded end-markers.

Terry Jan Reedy

Aug 10 '06 #53
On 2006-08-10 06:44:04, Stephen Kellett wrote:
Just found this on c.l.ruby. Seems kind of relevant.
http://www.americanscientist.org/tem.../assetid/51982

The Semicolon Wars
Good reading :) Thanks.

Gerhard

Aug 10 '06 #54
Stephen Kellett wrote:
In message <11**********************@b28g2000cwb.googlegroups .com>, Carl
Banks <pa************@gmail.comwrites
>Stephen Kellett wrote:
I don't really understand how a closing brace helps here. Care to
explain why it helps you?
>(Deeply nested long functions are evil anyways. If you have such a

I didn't write deeply nested. I wrote multiple levels of indentation.
They are not the same thing (they can be, but they don't have to be). A
lot of code gets to 3 or 4 levels of indentation quite easily. I
wouldn't call that deeply nested, not by a long shot.

To answer your first question: In C++/Ruby/Pascal you'd have something
like this

function()
{
loop1()
{
blah
blah

loop2()
{
blah

loop3()
{
blah
}

blah
}
}

otherloop()
{
blah
}
}

and in Python that gets to

function()
loop1()
blah
blah

loop2()
blah

loop3()
blah

blah3

otherloop()
blah

I really dislike that the end of loop2 is implicit rather than
explicit.
<nitpicking>
Well, one can argue that since Python grammar defines that a code block
ends with the first following non-blank line that one indentation level
less, it's perfectly explicit !-)
</nitpicking>

But practically speaking :
If its implicit you have to look for it.
Indeed. And yes, I agree that it's not that good wrt/ readability for
any complex or long block.

OTOH, nothing prevents you to add a "# end <block>" comment where
appropriate - FWIW, I used to do it in C after the closing brace for any
lengthy block (and code blocks tend to be longer in C than in Python).

Aug 10 '06 #55
Gerhard Fiedler wrote:
function()
loop1()
blah
blah

loop2()
blah

loop3()
blah
#end loop3()

blah3
#end loop2()
#end loop1()

otherloop()
blah
#end otherloop()
#end function()

Of course, few people will write like this, but it probably is easier to
write a Python code formatter that adds them than it is to write a C code
formatter that adds proper indentation and provides your preferred
placement of braces.
It's already there: Tools/scripts/pindent.py.

Georg
Aug 10 '06 #56
In message <ma***************************************@python. org>,
Gerhard Fiedler <ge*****@gmail.comwrites
>http://www.americanscientist.org/tem.../assetid/51982

The Semicolon Wars

Good reading :) Thanks.
Found something else relevant to this thread. The Pliant language.
Appears to use whitespace indentation for grouping.

http://fullpliant.org/pliant/languag...lt_syntax.html

Stephen
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
Aug 10 '06 #57

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.