Speaking Python

James Kew james.kew at btinternet.com
Sun Oct 19 07:46:32 EDT 2003


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message
news:eIEib.2016$Z_2.99048 at news20.bellglobal.com...
>
> def range underscore sum open bracket n close bracket colon new line
indent
> if n less than zero colon newline indent
>[etc]
>
> (this assumes that the user is aware that if no indent or dedent message
is
> given, the current level of indentation should be maintained).

I'm not sure this is a valid assumption, for two reasons:

a) I'm not sure that sighted readers keep track of the previous indentation
level when reading code: isn't it more the case that the amount of
whitespace at the start of each line gives you an idea of the scope of the
line's statements?

b) It's optimised for the straight read-through, from beginning to end. This
is proably the common case when reading other people's code, but when
editing or debugging your own code you're much more likely to be jumping
around from line to line.

Maybe reading the level of indentation at the start of each line ("indent 2:
if N less-than zero colon / indent 3: return None") would be more useful?

James






More information about the Python-list mailing list