Style question...

rzed Dick.Zantow at lexisnexis.com
Thu Aug 28 09:03:30 EDT 2003


Peter Hansen wrote:
> "U. N. Owen" wrote:
>>
>> For the moment I work on (a small part of) a project
>> that has hundreds of thousands of lines, almost
>> eveything in Python (and some in C and Fortran),
>> and when you have a loop several pages long, or
>> nested blocks to 8 levels or more, I may say
>> it's *very* convenient to see where the end
>> of a block exactly is. It's convenient to
>> have some long variable names too.
>
> I use Scite, which provides a graphical means of representation
> the indentation, with vertical lines that extend down at every
> indent level.  (It would have to be later in the day for me to
> be coherent enough to describe it better.)  Suffice to say that
> it provides more than adequate (for me) visual indication of the
> end of a block that stretches too far.
>
> A better point I'd make however is that if you have a loop several
> pages long, or a nested block 8 levels deep, the code needs
> refactoring!  Saying this occurs in a large project does nothing
> to excuse it: the more code you have, the greater the need for
> structuring it well.
>

The only times I've seen the lack of a block delimiter as a problem is
when somebody plops some sample code in a usenet message and uses tabs
for indenting. OE strips out the leading tabs for some reason, so
everything winds up flush to the left margin. Once in awhile it is not
possible to recreate the proper indention, and for that reason I try
to include comment delimiters in code I send. When I don't forget, at
least. A better solution might be to physically restrain the posters
of tab-infested code from doing that, but there are only so many hours
in the day. And if OE wouldn't do what it does ... but then, where
would be the fund in that?

--
rzed






More information about the Python-list mailing list