do people really complain about significant whitespace?
Rhamphoryncus
rhamph at gmail.com
Thu Aug 10 07:49:41 EDT 2006
Stephen Kellett wrote:
> function()
> loop1()
> blah
> blah
>
> loop2()
> blah
>
> loop3()
> blah
>
> blah3
>
> otherloop()
> blah
>
> Yes the above example is contrived - so that I could demonstrate what I
> wanted to demonstrate. But I've run into these problems with Python code
> I've written and when reading code written by others. Its a real
> problem, not just one I've cooked up for an argument.
[much snippage]
I actually agree with you here; when indentation goes on longer than a
screen it can become difficult know what that indentation is associated
with. Braces may mitigate it somewhat, but not completely. Some
points to consider:
* Python is inherently shorter than C/C++, so you're less likely to go
over one screen.
* Long functions should usually be refactored anyway and would gain
readability in any language. The threshold here is smaller in python
because your code will do more significant things, vs C where your
screen gets covered with minutiae that you learn to mentally ignore.
Also, I wonder if a more intelligent editor would help here, one that
would visually indicate blocks as such:
function()
| loop1()
| | blah
| | blah
| |
| | loop2()
| | | blah
| | |
| | | loop3()
| | | | blah
| | |
| | | blah3
|
| otherloop()
| | blah
Surely this would eliminate the problem?
More information about the Python-list
mailing list