[Tutor] Newbie Anxiety

Terry Kemmerer wildcard2005 at comcast.net
Fri Nov 11 02:03:40 CET 2005


A good natured word of explanation for Chris and others:

Rest assured I am not criticizing the FORM and USE of white space that
Python so eloquently uses, 
and subsequently makes it so beautiful and easy to read to the eye, by
my example 
of a single line of BASIC. Actually, back in the day, I would never have
written it the 
way I did for my question. I would have written it this way:

10 X=X+1:?X:GOTO10 

(The Computer would have automatically translated that to  10 X=X
+1:PRINTX:GOTO10)

And I would have written Chris's for next loop as follows:

10 FORN=1TO10:?N:NEXTN: REM  It is bad form not to name N after NEXT to
label which FOR NEXT loop is being incremented.

And I would not have been ashamed of the crunched out spaces, nor the
multiple statements per line, because in the 
real world when you are building a business, you do what you need to do
to get the job done. Let me explain. My 
company was writing full blown computerizations of every aspect of
various kinds of companies on micro computers in the micro revolution,
and replacing big IBM systems with tiny multi-user systems, and we had
only 48,000 bytes of RAM CORE, of which 20,500 bytes was used for the
entire operating system, which included either OS-65D or OS-65U Basic
programming languages of OSI (Ohio Scientific Inc.), which left only
27,500 bytes to construct your entire program in. We were selling
against the BIG machines, (WE WERE BEATING THEM OUT!) and we needed
SPEED, which meant a lightning fast BASIC (which we hired Steve Jobs to
create when he was a starving software engineer) and then we implemented
coding in ways that sped that up further. Spaces and wasted lines that a
teacher would have given me an A+ for in school (if there had been a
class on it), in the real world, both cut down on the speed of execution
of the program and drastically cut back on the amount of what could be
accomplished in a single program, thus forcing a jump to a new program,
all of which again cut down on speed of getting things done because we
had to write our variables to disk before making the jump, and then
reloaded them in the "chained" program next to be executed making a big
PAUSE in the process of processing.  (Of course, don't forget we also
had to leave room for all of the data we were going to hold in memory
also......IT ALL SHARED THE SAME 27,500 bytes.

To give you an idea of how successful we were at invading BIG BLUE's
turf with our tiny machines, we ended up specializing in Telephone
Companies, after having written complete "turn-key" systems for many
many different kinds of companies. And in all of those lines of code my
company generated, which surely must be in the seven figures, GOTO, and
its other versions was unabashedly and freely used because BASIC is a
line-number-orientated language, and GOTO naturally follows as the size
of the program increases. And I can only say to you, from a personal
point of view, that the real grade for excellence that counts, is the
real world reward of what happens and continues to happen with your
business's bank account. Customers buy solutions that work out well for
them, both in the sale and after the sale....they just want it to work.
And while I am sure someone is thinking Spaghetti Code, our style was
highly conventionalized, something that we enforced rather strictly.
What can I say? It worked out great! Maintaining the programs and adding
new 
abilities was never a problem. When I sold the company, we were still
writing 99% of our code in Basic. (IT WAS A VERY 
VERY VERY FAST BASIC.) So, you see, Basic was my ONLY language.

But that was the PAST. This is FINALLY the FUTURE. And while I am a bit
disappointed those flying cars that were promised aren't here yet, we of
the future now have the luxury of white space with no downside. It makes
sense to use it as part of the programming logic. And while I am used to
reading condensed code more than I am the great open spaces of
programming freedom today, I will surely get used to it, and love it. My
only real concern has been in how the flow of python works for the WHOLE
PROGRAM FLOW, and you all have help me a lot here.......and I really
appreciate it. And I assure you, intend to CONFORM to how Python sees
itself being written. This is, after all, the future. 

I am really looking forward to the adventure of Python. And rest
assured, I read up on all the other languages first, as it is my habit
to trace the path to the goal in advance of launching the ship, and
nowhere do I find as much potential in the view I gained, than python
affords. Which is why I am braving the waters of SOMETHING DIFFERENT,
that is MUCH BETTER!

And n =+ 1 is an abbreviation that warms my heart to see!

Thanks,

Terry




On Thu, 10 Nov 2005, Terry Kemmerer wrote:

> I'm working on Ch. 5, "Fruitful Functions", or "How To Think Like A
> Computer Scientist" and I still can't count.
> (Don't laugh! I can't play the violin either...)
>
> In Basic, I would have said:
>
> 10  x = x + 1 :  print x : goto 10

    Good heavens! I never used GOTO, even on the C-64:

10 for n = 1 to 10
20 print n
25 rem n = 1 rem  remove first rem for infinite loop
30 next


> run
> 1
> 2
> 3
> etc....
>
> I don't know why, but this great UNKNOWN bothers me a lot. Maybe it is
> because it was the first thing I learned in Basic,
> back 20 years ago when I was actually a programmer....  But I  think it
> goes toward visualizing how things are
> going flow and be constructed without line numbers and the venerable
> GOTO statement.
>
> How is this done in Python? (So I can stop holding my breath as I study
> this great language....and relax.)

n = 1
while n <= 10:
   print n
   n = n + 1


    Or:

for n in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]:
   print n


    Or:

for n in range(10):
   print n + 1


    Etc......


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051110/965346c0/attachment.htm


More information about the Tutor mailing list