[Python-Dev] Re: decorators and 2.4
janssen at parc.com
Sat Jun 26 00:40:21 EDT 2004
Paul Prescod writes:
> The left edge is already cluttered.
> a = 5
> b = a()
> def foo(xyz):
> abc = 5
> c = 20
> It is the indentation that alerts your eye to the function definition.
Paul, most modules have global variables defined only in one place,
usually well-marked, so you don't usually get the clutter that you
cite here. Scripts, of course, are an exception.
> Nobody reads code one line at a time from the top down. You scan for the
> bit that interests you and then look around for its context.
It's of course the scanning that I'm talking about. Having only "def"
and "class" at the left edge makes it remarkably easy to scan for a
function or class definition. Putting oddly-shaped decorators there
too ruins this.
But I disagree with your statement here. Everyone reads *unfamiliar*
code one line at a time from the top. If you're really reading it, I
mean, rather than just looking for something in it.
More information about the Python-Dev