A decorator syntax not yet mentioned (I think!)
Jeff Shannon
jeff at ccvcorp.com
Thu Aug 12 18:13:31 EDT 2004
Mark Bottjer wrote:
>
> FWIW, I don't object to the keyword, I object to the indented block. I
> agree that newbies will need to look either up. My only real concern
> is that certain suggested syntaxes (mostly the list or tuple forms)
> look innocuous enough that newbies may not realize that they've hit
> something new. Everything past there seems more and more like simple
> preference.
The interesting thing here is that it seems that the reason you dislike
the indented block is the reason given for preferring it by those people
who *do* like it -- the fact that it *looks* like normal Python.
Frankly, if a new feature is so radically different from the rest of
Python that it's deemed that it needs to *look* radically different from
the rest of Python for it to be understood... that, to me, suggests that
it's a feature that shouldn't exist in Python. All the criticisms aimed
at the decorate: syntax, ISTM, apply equally well to @pie syntax, except
for the few that are based on indentation level. And on those, *I* at
least feel that it'd be preferable to pattern decorators after existing
language constructs, rather than deliberately breaking all the patterns
that Python has established. I don't see the indented declarations as
any harder to understand that nonindented, @tagged declarations, but I
*do* see them as being much easier to read. And I expect to read a lot
of code, so having something visually jarring seems like setting myself
up for a future full of low-grade anguish.
I see your point about it looking a bit odd that an indented block
contain only declarative statements. However, the @pie mess in front of
function defs looks, to me, to be not just odd, but downright
obfuscatory. It's *much* harder for my eyes to pick out the def and
thus the function name, and all I see is a function body dangling from a
blob of @pies.
Yes, this is personal preference, but it seems that it's a preference
shared by many people -- isn't Python supposed to fit my brain, rather
than forcing my brain into Python's shape? The fact that one can get
used to @pie-syntax doesn't mean it's intuitive. The fact that the
feature is new doesn't mean that we need an entire new code-layout
principle. The differences between class & def, on the one hand, and
try/except & if/else on the other, don't seem to confuse people too
much. I'd rather see the same layout principle applied in a different
way than see an unprecedented and unfamiliar layout principle used in
one or two special cases.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list