A little disappointed so far

Terry Reedy tjreedy at udel.edu
Mon May 19 09:34:03 EDT 2003


"Graham Nicholls" <graham at rockcons.co.uk> wrote in message
news:Mv2ya.4193$573.1871 at news-binary.blueyonder.co.uk...
> I find it easy in c to press % and jump to the bottom of a loop.
How can I
> do this for Python files.  The increment was a legal, sensible
command, but
> not indented enough, so the loop

By collapsing the intervening blocks down to a line or so.  I
sometimes use the PythonWin editor which has little +s and -s in the
left column that, when clicked on, expand and collapse compound
statement blocks.  This make it *much* easier to line up a statement
with one above that would otherwise be off the screen.

> BTW, why no ++ operator?

a) ints are not mutable.  This gets to the difference between 'name
denotes block of memory' (as in C, etc) and 'name denotes object' (as
in Python, etc).
b) not needed for looping: 'for i in range(n):' does it for you.  If
you do not use 'for' more often than 'while', you are probably not
using Python at its best.

How I learned Python (to begin with):  after tutorial, I read
interesting part of Ref Manual and Library Manual (eventually all of
former).  I *also* read the source code of at least the string module
and the os and os.path modules at least down to the function def lines
and following doc strings.  That is how I learned exactly what is in
the os module (in that version) (and something about Python style).
In *parallel*, I did lots of experiments with the interactive
interpreter (one of Pythons great features for me).  If I was not sure
about something in the ref manual, perhaps as applied to an edge case,
I tried it out.  Ditto with string functions.

Last comment: it is possible that your brain is less well matched to
Python and better matched to something else than for some of use who
love it.  But only you can decide this and whether or not to continue
your experiment.

For better programming,

Terry J. Reedy






More information about the Python-list mailing list