[Python-Dev] Re: PEP 318: Decorators last before colon

Skip Montanaro skip at pobox.com
Mon Apr 5 12:58:22 EDT 2004


    >> One virtue of Guido's proposal is that it is basically what C#
    >> does. Java uses a pretty different syntax but it is also a prefix
    >> syntax. If Python uses a postfix syntax it will probably be alone in
    >> making that choice.

    Guido> That's exactly Jim Hugunin's argument for this syntax.

Since both C# and Java differ significantly in their typing from Python I
suspect what works well for those languages (they already have a lot of
declarative "baggage" because of their compile-time type checks, so what's a
few more declarations?) may not work as well for Python.

Second, Python has a strong tradition of borrowing what"works well" from
other languages.  I'm skeptical that C# has been around long enough to
suggest that its syntax "works well".  It's pretty clear that Microsoft is
going to ram that down most programmers' throats, so the C# user base is no
doubt going to be very large in a year or two.  If what you're looking for
is to provide a familiar syntactic base for C# refugees, then I suppose
that's fine, but from the examples I've seen, C# decorations (annotations?
attributes?) can be sprinkled quite liberally through the code (and serve as
much to obscure as to highlight what's going on).  A C# refugee might be
disappointed to see that Python's decorators are limited to class, function
and method declarations.  With that in mind, it doesn't seem to me that
partially mimicing C#'s decorator system is necessarily a good thing.

Skip



More information about the Python-Dev mailing list