[Python-Dev] Re: Python-Dev Digest, Vol 8, Issue 107
Michel Pelletier
michel at dialnetwork.com
Wed Mar 31 19:50:32 EST 2004
On Wed, 2004-03-31 at 16:23, Phillip J. Eby wrote:
> >The current system with no syntax is equally usable, what's gained
> >functionally?
>
> It's not equally usable. It is 1) considerably more verbose, particularly
> in Bob's use case of long function names, and 2) hard to spot by a reader
> who's skimming to get an overview of a class or module.
Both true. Perhaps I should have said functionally equal. The proposed
syntax is more usable from a syntax perspective, I agree, but offers no
more "use" once you have the object in hand, so to speak. The
aesthetics is another matter I've already voiced my opinion on.
> >Another discussion point occurred to me regarding interfaces and
> >projects that use them heavily like Zope, Twisted, PEAK etc. Has the
> >decorator syntax as proposed been evaluated in the light of these
> >interfaces (and any future native language support for them), whose
> >methods have no body to interpose between the definition and decorators
> >as they exist now? I've seen the "Large Body" argument use several
> >times in defense of the decorator syntax being before or above the
> >definition.
>
> I have seen virtually no use of decorators on interface methods in the
> frameworks you mention. In fact, I can't recall ever having seen a single
> use of decorators on interface methods. That's probably simply because the
> cost of using decorators is too high to waste on anything that's not part
> of the implementation,
I think there must be *some* decorators valid for interfaces. What
about proposed decorators like "synchronized"? Are these part of the
interface? Or something equivalent to Java's "throws", arguably a
decoration and arguably part of a method's interface. What about
decorations that can *never* be used in an interface, like
"classmethod"? Would an error be raised if you tried to decorate an
interface method with a classmethod decorator?
I don't think any of these things refute or validate the need for
special syntax, I just wonder if it's been thought about enough, and
that goes way beyond the syntax.
-Michel
More information about the Python-Dev
mailing list