Indentation problem
phil hunt
philh at comuno.freeserve.co.uk
Mon Mar 25 14:11:25 EST 2002
On Mon, 25 Mar 2002 14:16:49 +0100, Gilles Diribarne <gdiribarne at udcast.com> wrote:
>Hi,
>
>I like Python language and use it every day. But...
>I read some articles from October, 1998 where there was a fight with
>space and tabs and indent problems.
>Today, we can found code with spaces and tabs in the code.
>
>I've some problem with identing code. I'm allright with the example.
>But, I think it's important to have an "end" building block like "!:"
>
>What do you think about that?
>
>Why I would like to put this in the code?
>1/ Because it's almost impossible to paste python code with ident = n
>spaces to another code with indent = m spaces
>This kind of examples occurs more and more and you can indent the code
>by hand when it's 10 lines of codes, but not 1000 code lines.
>It prevents the re-use of code pieces.
This implies 2 things:
(1) you regularly cut and paste 1000-line code fragments
(2) when you do this in other langs, such as C, you don't bother
reformatting.
I'm glad I don't have to maintain your code!!!
Some editors, such as nedit, allow you to indent/outdent blocks of
code. I suggest you use such an editor if this is a problem for you.
>2/ Programmers wants independence: some wants to manage building blocks
>with spaces, other with tabs, some wants length = 4 with tabs.
These people have the option of not using python.
The python standard defines tab == 8 spaces.
>I would like to use my own programming style! But, my code risks to be
>not supported by others.
There's a python indent utility, that allows code to be re-indented.
You could extend this, so that everyone gets the code in the format
they like, and it gets put in CVS in a standard format.
>4/ Solve the problem of space and tabs length. But, we should keep the
>indenting mode which produces beautifull syntax.
>pythona.py:
> def func():
> a = 1
> if a == 1:
> a ==2
> print "beatifull! Isn't it?"
No idea what you are getting at here.
>You cannot merge correctly or tell me how to do this ?
>This is simply because the language doesn't have a "end" instruction
>block. It has ":" as beginning instruation block.
>I would like to propose an end instruction block like "!:" or "end"
How about using "#end"? Or "#end def", "#end for", etc.
--
<"><"><"> Philip Hunt <philh at comuno.freeserve.co.uk> <"><"><">
"I would guess that he really believes whatever is politically
advantageous for him to believe."
-- Alison Brooks, referring to Michael
Portillo, on soc.history.what-if
More information about the Python-list
mailing list