Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Indent testers needed (Prothon)

Reply
Thread Tools

Indent testers needed (Prothon)

 
 
Mark Hahn
Guest
Posts: n/a
 
      04-03-2004
We're proud to say that Prothon has grown out of the indent space/tab flame
war stage and has moved on to more serious discussions.

We've decided to allow space-based indents and tab-based indents but not in
the same file. We are also adding some improvements in the area of line
continuations (see the algorithm at the end of the message).

Since there were zillions of messages here on c.l.py about spaces vs. tabs
and Guido has said he wants to remove tab support, I thought maybe some of
you might help us test our implementation of this indentation algorithm.

Can I get a few space lovers and tab lovers to download this windows
executable and tell us if this makes them happy? If you keep your Python
code simple and free of class statements, you don't have to learn Prothon to
try it. You can't use the interactive console to evaluate the algorithm,
you will need to write *.pr code files and run them. Note: This is not a
real Prothon release. It has not been through normal testing. Use it only
for indent testing.

The zip file (350K) is at:

http://prothon.org/pub/prothon/Proth...b255-win32.zip

Unzip the file which will make a folder called win32. Drop your .pr file
into the folder. Open a dos command window. CD to the win32 folder and run
the prothon.exe file with the .pr file name:

prothon.exe code.pr

Features:

1) You must use only tabs or only spaces for indents in any one file. You
cannot mix them.

2) Each indent level can have any number of characters more than the
previous level, whether you are using tabs or spaces. If you drop back to
the left to dedent, and your column position does not match any level above,
you will get a lexer error.

3) If you increase the indentation level above the previous line by even
one space, and that previous line does not end in a colon, then the new line
will be considered a continuation of the previous line.

4) If a line contains an active (not quoted or commented) (, {, or [
without a matching end character, then the following line is always a
continuation, no matter what that following line contains.

5) There is still support for using the trailing backslash ( \ ) to indicate
that the next line is a continuation. This may be removed in the future if
everyone agrees to do so.



 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      04-03-2004
Mark Hahn wrote:

> We're proud to say that Prothon has grown out of the indent space/tab flame
> war stage and has moved on to more serious discussions.
>
> We've decided to allow space-based indents and tab-based indents but not in
> the same file.


I've (thankfully) missed all the Prothon-related wars about indentation,
clearly, but I have to ask, isn't this "solution" rather ill-conceived
still?

What about copy-and-paste from one file (which was done with spaces)
to another which is using tabs? Kind of puts a crimp in one's style
there, I would think...

Just a thought.

I heard a rumour Python is heading for "no tabs", period. Why not just
simplify everyone's life and do the same for Prothon, and leave the
whole darned issue in the past. In a year no one will be complaining
about their beloved tabs anyway...

(Oooh... won't that get another flame war started? I think I'll
skip it... I just wanted to make the first point. And should probably
have stopped there.)

-Peter
 
Reply With Quote
 
 
 
 
Mark Hahn
Guest
Posts: n/a
 
      04-03-2004
This was a bit premature. Some of our test cases give indentation errors.
I'll post another file when it is really ready for testing.

Meanwhile comments on our intended solution would be greatly appreciated.


 
Reply With Quote
 
Mark Hahn
Guest
Posts: n/a
 
      04-03-2004
"Peter Hansen" <(E-Mail Removed)> wrote ...
> I heard a rumour Python is heading for "no tabs", period. Why not just
> simplify everyone's life and do the same for Prothon, and leave the
> whole darned issue in the past.


I first said tabs-only since I'm a tabs lover and the tabs-haters came out
and crucified me. Because of that and the fact that I found out that Guido
wants to pull tabs from Python, I said we were going to spaces-only and then
the space-haters did the same. I don't think Guido has a chance in hell of
ever pulling tab support from Python.

> In a year no one will be complaining
> about their beloved tabs anyway...


Yeah right (giant laugh).


 
Reply With Quote
 
rzed
Guest
Posts: n/a
 
      04-03-2004
"Mark Hahn" <(E-Mail Removed)> wrote in
news:b5rbc.132699$cx5.63133@fed1read04:

> This was a bit premature. Some of our test cases give
> indentation errors. I'll post another file when it is really
> ready for testing.
>
> Meanwhile comments on our intended solution would be greatly
> appreciated.
>
>
>


Some odd-looking things can happen, as it stands. These two
loops parse correctly:

alist = [3,7,11]
blist = [1,2,
3]

# loop 1
ix = 2
for item in blist:
alist[ix] = alist[ix] + item
print alist[ix]
ix = ix - 1

/* loop 2 */
ix = 2
for
item
in
blist
:
alist[ix] =
alist[
ix
]
+
item
print alist[ix]
ix =
ix
-
1

--
rzed

 
Reply With Quote
 
Mark Hahn
Guest
Posts: n/a
 
      04-03-2004
"rzed" <(E-Mail Removed)> wrote

> /* loop 2 */
> ix = 2
> for
> item
> in
> blist
> :
> alist[ix] =
> alist[
> ix
> ]


Do you think this is a good thing or a bad thing? You could do the same
thing or worse in C or Java.


 
Reply With Quote
 
Mark Hahn
Guest
Posts: n/a
 
      04-03-2004
I have a newer better-working version to download and test:

http://prothon.org/pub/prothon/proth...b266-win32.zip

The instructions are the same except the folder name will be Prothon:

Unzip the file which will make a folder called Prothon. Drop your .pr file
into the folder. Open a dos command window. CD to the win32 folder and run
the prothon.exe file with the .pr file name:

prothon.exe code.pr

Features:

1) You must use only tabs or only spaces for indents in any one file. You
cannot mix them.

2) Each indent level can have any number of characters more than the
previous level, whether you are using tabs or spaces. If you drop back to
the left to dedent, and your column position does not match any level above,
you will get a lexer error.

3) If you increase the indentation level above the previous line by even
one space, and that previous line does not end in a colon, then the new line
will be considered a continuation of the previous line.

4) If a line contains an active (not quoted or commented) (, {, or [
without a matching end character, then the following line is always a
continuation, no matter what that following line contains.

5) There is still support for using the trailing backslash ( \ ) to indicate
that the next line is a continuation. This may be removed in the future if
everyone agrees to do so.

6) A continuation line is effectively added to the end of the previous line
so any line following a continuation line uses the last non-continuation
line for the "previous line" in all the rules above.



 
Reply With Quote
 
Josiah Carlson
Guest
Posts: n/a
 
      04-03-2004
>>/* loop 2 */
>>ix = 2
>>for
>> item
>> in
>> blist
>> :
>> alist[ix] =
>> alist[
>> ix
>> ]

>
>
> Do you think this is a good thing or a bad thing? You could do the same
> thing or worse in C or Java.


It is a bad thing. Just because you could do worse in a language that
is indentation agnostic, doesn't mean that you shouldn't discourage (if
not disallow) such behavior in a language that is bases scope on
indentation.

The above code shows how you can make Prothon code extraordinarily ugly
by exploting the continuation rules. Certainly most people don't see
such ugly continuations in Python, but I think rule #3 is begging for
trouble.


- Josiah
 
Reply With Quote
 
Ville Vainio
Guest
Posts: n/a
 
      04-03-2004
>>>>> "Peter" == Peter Hansen <(E-Mail Removed)> writes:

Peter> I heard a rumour Python is heading for "no tabs", period.
Peter> Why not just

I find this rumor hard to believe - there would have been some more
official announcement, and the resulting code breakage would be
major. Not all legacy code can be run through reindent.py either...

I think the most sensible thing would be to give warnings on mixed
indenting by default, not by some command line switch nobody
uses. Newbies get burned by it all the time.

Alternatively, change the tab size as interpreted by Python to 321
spaces. The current assumption of 8 violates "explicit is better than
implicit".

--
Ville Vainio http://tinyurl.com/2prnb
 
Reply With Quote
 
Ville Vainio
Guest
Posts: n/a
 
      04-03-2004
>>>>> "Mark" == Mark Hahn <(E-Mail Removed)> writes:

Mark> I first said tabs-only since I'm a tabs lover and the
Mark> tabs-haters came out and crucified me. Because of that and
Mark> the fact that I found out that Guido wants to pull tabs from
Mark> Python, I said we were going to spaces-only and then the
Mark> space-haters did the same. I don't think Guido has a chance
Mark> in hell of ever pulling tab support from Python.

Just allow both spaces and tabs, but not in the same block. If someone
with a crippled editor (e.g. non-programmers which might default to
notepad, or someone not on his own computer) tries to create a new
function in a spaces-only file, he's going to be so ****ed because he
has to hit spacebar 4 times instead of one tab to make the code look
the same.

--
Ville Vainio http://tinyurl.com/2prnb
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gnu indent: how to avoid extra indent? dt C Programming 4 12-31-2006 11:31 AM
Beta testers needed for Web Page Layout, Controls, and Site Navigation Add-in Robert Weatherford ASP .Net 0 04-12-2004 04:06 PM
DVD Register Beta Testers Needed Tom Orlofsky DVD Video 1 12-22-2003 02:21 AM
loading testers needed Richard HTML 5 10-07-2003 05:28 PM
Re: .NET developers/testers needed-Urgently jlarana MCSD 1 08-29-2003 03:18 PM



Advertisments