A question on the direction of Python

Terrence M. Brannon (brannon@jove.cs.caltech.edu)
Sun, 12 Jul 92 09:07:03 PDT

I notice I have to do certain things by myself in Python that it would
be nice if there were registers for. The one example I keep running
into right now is if I have a loop like this:

tmp = open('file','r').readlines()
iterationCount=0
for line in tmp:
iterationCount = iterationCount + 1
if regex.match('adfasdf',line) > 5
break
else:
serverloop_code.insert(iterationCount,line) # line X

It would be nice if iterationCount were a pre-defined register like @i
or something so the code could be more compact . However, it would be
more cryptic to someone just getting into the language. Registers were
the main thing that made me quit learning Perl quickly.

Another way to look at this is that since Python is an object-oriented
language the for statement above is sending a message to `for' with 2
arguments. Since objects have their own private data, it would seem
that we could type serverloop_code.insert(for.current_pos(), line) at
line X to access some data in the `for' object.

What do you all think ?

--
terrence brannon
brannon@jove.cs.caltech.edu