durusmail: qp: Re: Another Proposed Template Notation
Another Proposed Template Notation
2007-11-01
Re: Another Proposed Template Notation
2007-11-01
2007-11-01
2007-11-01
2007-11-01
Re: Another Proposed Template Notation
2007-11-02
2007-11-02
2007-11-02
2007-11-02
2007-11-02
Re: Another Proposed Template Notation
Michael Watkins
2007-11-01
* David Binger wrote on [2007-11-01 11:28:08 -0400]:
> def f(x:int, y:list) -> float:
>
> I'm proposing using a similar annotation syntax for annotating the
> function name, using a colon and either "xml" or "str" to say that
> the function is a template and that it should be compiled using
> the "xml" transformation, or the "str" transformation.

Without any thought at all to whether this would be implementable in
Python < 3.x, using Python 3 annotation syntax as a guide. (I say
this not knowing if the new annotation syntax is an all or nothing -
i.e. both parameters and return values - approach or not.)

Python 3:
> def f(x:int, y:list) -> float:

Would this make some sense, and is it implementable:

    def f(annotated, parameters, or not) -> xml:
    def f(annotated, parameters, or not) -> string:

Having just written that, it is perhaps not such a good idea as it
may perpetuate the notion that only the return value is "xml" or
"string".

As for your proposal:
> def f:xml():
> def f:str():

I like this better than ``@[xml]`` if for no other reason than it is
easier to type. I also think it looks cleaner than the
decorator-like syntax.
reply