tabs do WHAT?

James Logajan JamesL at Lugoj.Com
Tue Jan 25 00:28:08 EST 2000


Warren Postma wrote:
[A whole lot of misinformed patronizing and opinionating elided.]
> Even BASIC, ugly as it is from a functionality point of view, is miles ahead
> from the point of view of useability by people who are skilled technical
> people, yet who are not "programmers".

You don't know ugly. And what you think is BASIC really isn't. Python
indentation requirement is one of the two most beautiful and satisfying
aspects of the language.

Been programming for 25+ years. Wrote the following BASIC program to display
lines of electric potential on a home-brew display device on a "fast" 4Mhz
Cromemco Z-80 system with 16K byte ram using TDL BASIC. At least I think
that is correct. It was written back when I was studying physics and did not
consider myself a "programmer". Now tell me if you can figure out the block
structure (I had to do this all the time, since most BASIC interpreters
would not preserve indentation.):

10 DEF FNED(K)=(K<0) OR (255<K)
20 INPUT "# LINES";S
30 PI=3.1415926535*2
40 SS=PI/S
45 REM CLEAR DISPLAY
50 OUT 0,2 : OUT 0,1
60 INPUT"# CHARGES";N
70 DIM QM(N),X(N),Y(N)
80 FOR I=1 TO N
90 PRINT I;
100 INPUT QM(I),X(I),Y(I)
110 IF FNED(X(I)) OR FNED(Y(I)) THEN 90
115 REM DRAW POINT AT CHARGE LOCATION X(I),Y(I)
120 OUT 2,Y(I) : OUT 1,X(I)
130 NEXT I
140 FOR I=1 TO N
150 A=0
160 FOR C=1 TO S
170 A=A+SS
180 X=X(I) : Y=Y(I)
190 X=X+COS(A)
200 Y=Y+SIN(A)
210 IF FNED(X) OR FNED(Y) THEN 390
215 REM DRAW NEXT LINE POINT AT X,Y
220 OUT 2,Y : OUT 1,X
230 XS=0 : YS=0
240 FOR J=1 TO N
250 XD=X-X(J)
260 YD=Y-Y(J)
270 R1=XD*XD+YD*YD
280 IF R1<.99 THEN 390
290 R1=SQR(R1)
300 K=QM(I)*QM(J)/(R1*R1*R1)
310 XS=XS+K*XD
320 YS=YS+K*YD
330 NEXT J
340 R=SQR(XS*XS+YS*YS)
350 IF R=0 THEN 390
360 X=X+XS/R
370 Y=Y+YS/R
380 GOTO 210
390 NEXT C
400 NEXT I
410 END



More information about the Python-list mailing list