Re: multi-statement lines ( why can't I ... )

Steven D. Majewski (sdm7g@elvis.med.virginia.edu)
Fri, 10 Dec 1993 19:23:55 -0500

On Dec 10, 18:52, Tim Peters wrote:
>
> I confess I find Python's
>
> for x in list:
> if testof(x):
> do_something
> do_something
> do_something
>
> just as clear as, e.g., Icon's
>
> every x := !list & testof(x) do {
> do_something
> do_something
> do_something
> }
>
> The syntactic patterns differ, but neither is really more complex (both
> name x twice, both separate list-crawling from predicate testing, both
> take a (teensy) bit of thought to understand).
>

I still like:
for x in list:
if x < value:
do_something
better than 'filter' for both clarity and effeciency.

The major desire for getting the test on one line is in
interactive use - especially with readline's ^P, ^H to
scroll back thru commands. It's a lot nicer to get the
selection, at least, one one line, if not the whole command.

[ But I suppose all you Gnu-wizards out there do everything
from within emacs! ]

In a module, sometimes it would be nice to avoid getting too
indented, but I can live with that. In 'C', you can usually
go by the rule that if your code is getting too indented to
handle, then it's time to extract some of it into a function.
With Python's 'mandatory indenting', I find this rule a little
harder to follow. When I'm at an X-window, it doesn't bother
me much - I just strecth my xterm a little wider. But when
I'm editing at home, I find myself stripping extra spaces
between function arg's and list and tuple elements to be able
to read everything in 80 cols.

- Steve M.