decorators as a special case of an @ operator?
Jeffrey Froman
jeffrey at I.slack
Tue Aug 10 00:10:47 EDT 2004
Peter Hansen wrote:
> I believe those of us who prefer to see the name first really
> prefer to see something we might call the definition (and
> "def" is well-named here) which includes a sign that we are
> defining a function, very near the name, and preferably with
> the argument list also very close (since it is generally quite
> important to a reader)
For me, it's much more about the visual association of related statements.
Whitespace is critical for visual association in Python, and having
decorators floating above a definition absolutely wrecks the whole top-down
indentation scheme. I could learn to get used to the '@', because that
really *is* just a decorator, but having referential statements ride on top
of a function definition *breaks* the way python reads.
So I like Dan's idea as far as that goes, but in the same way I can also
live with
def f():
@decorator1
@decorator2
Jeffrey
More information about the Python-list
mailing list