declarations summary

Arthur ajsiegel at optonline.com
Mon Feb 7 08:52:40 EST 2005


On 6 Feb 2005 20:34:22 -0800, "Michael Tobis" <mt at 3planes.com> wrote:

>
>General usage has "declaration" meaning "statement which does not
>generate executable bytecode but merely affects the compiler". My
>assertion that decorator syntax is "declarative" is therefore formally
>false.

I'm not sure what this adds to the discussion, but I think it worth
noting that PEP318 and Guido's own discussion make it very clear that
the choice of Python decorator syntax was influenced - presumable by
the drawing of some analogy - to Java Annotation syntax:

http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html

The documentation as to Java annotations seems clear tht annotations
are considered as declarative, within the context of the Java
language.

But also in those docs:

"""
Typical application programmers will never have to define an
annotation type, but it is not hard to do so.  
"""

IMO, there was that analogy as well that had some influence on the
decision.  It needed to be something that communicated decorators as
something beyond the scope of "everyday Python".  Which would mean
something not too deeply embedded, which may account for the reason
that the proposals with more obvious surface aesthetic appeal like the
one's you refer to were rejected.

Beauty of course being only skin deep.  Given that the decorators had
to happen when they happened (that being a separate point of
contention), I happen to think Guido's choice was a good and
courageous one.

Art




More information about the Python-list mailing list