durusmail: qp: 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
Another Proposed Template Notation
David Binger
2007-11-01
Currently, templates are denoted by [html] (or [plain]) between the
function name
and the parameter list.

I've proposed (and implemented) an alternative form I call template
decorators,
where "@[xml]" or "@[str]" appears on the line before the def.

I've thought of another possibility that I want to run by you.

In python 3, we can (optionally) annotate parameters and functions
like this:

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.

def f:xml():

or

def f:str():


Maybe this notation fits best into the python of the future.

I like that it is as grep-able as the current notation, but a little
shorter.

What do you think?



reply