Indentation/whitespace

J

Jon Perez

Joe said:
As for me, I'm not suggesting that braces are better than indentation.
In fact, requiring indentation is a good idea, and I agree that braces
can be quite ugly. It is the lack of visible block closing when there's
more than one level that I dislike.
... I'm talking about double un-indent at the end of a nested loop,
where the inner-most code is long enough that the end is a double
dedent. It is especially bad because one persons single dedent can be as
big as another persons double dedent. I agree with dislikes for brace
notation, but I think it goes against the argument that Python's way is
natural and right.

For me, I just feel Python's approach is simple and works.
If one includes an end-thing for every start-thing, I think it is more
natural, and still far better than C, but also more verbose.

Indeed. I don't like unnecessary verbosity.
In Python, one can use comments where needed, like below, which is what
I eventually started doing. But, Python is supposed to require 'easy to
read' code.

if ...
for x...
for y...
... lots of code ...
#end for
#end for
#end if

Well doesn't that mean that in Python, you get the best of both worlds?
You can make it verbose if you need the security of closing tokens,
but it is not necessary.

I suspect you may still have some sort of hangover from using C-style
indentation in that you are subliminally not confident that a block
is properly closed unless there is a visible closing token.

The main thing that I just don't get is why Python promoters are so
sure that everyone will like the Python syntax once they get used to it.

I myself would never assume that 100% of people will like Python syntax. But
I know I took to it (including and *especially* the enforced indentation)
like a duck to water, and apparently so do many people. But then that's
why there are other languages out there. ;-)
 
T

thakadu

It just has to be consistent within a *single* block.

Correct, and therein lies the problem I am describing.
If someone has used two spaces and you paste into
the SAME block where you are using four spaces
you will break your code.
 
D

Diez B. Roggisch

thakadu said:
Correct, and therein lies the problem I am describing.
If someone has used two spaces and you paste into
the SAME block where you are using four spaces
you will break your code.

And then you invoke your "in/dedent block" function of your editor, and
things work. Similar to hitting "Format Source" in eclipse for JAVA.

Diez
 
T

thakadu

Yes, thats what you have to do. And that was my original point, you
cannot just paste and go, you have to first reformat.
 
D

Dave Hansen

Yes, thats what you have to do. And that was my original point, you
cannot just paste and go, you have to first reformat.

My heart bleeds.

Regards,
-=Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top