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
mario ruggier
2007-11-02
While we're at it... here's another idea:

def @xml some_function (a: int, b: string):
    'some text'
def @str some_function (a: int, b: string):
    'some text'

Altho i prefer the cleaner looking ':', this seems to be more in step with
the "decoration" concept, and it certainly serves the purpose of making the
standard compiler choke.

Or:

def some_function (a: int, b: string) -> [xml] :
    'some text'
def some_function (a: int, b: string) -> [str]:
    'some text'

Or even:

def some_function!xml(a: int, b: string):
    'some text'
def some_function!str(a: int, b: string):
    'some text'

Hmmn, visually the exclamation mark works well with the idea that "incoming
data will be cast to xml". And, it is also makes for a rather visual
SyntaxErrot. But, actually the "!" is the char used to denote the "Explicit
Conversion Flag" (even if in the very specific context of format
specifiers) in the Advanced String Formatting PEP, at:
http://www.python.org/dev/peps/pep-3101/


> def f:xml():
>
> or
>
> def f:str():
>
> Maybe this notation fits best into the python of the future.

Then might'nt there be actually a slight danger it may fit too well, i.e.
it may conlict? Given the ":type" syntax is adopted for the args, maybe
same for the function name will be adopted (to mean whatever). Is the
syntax finalized for function annotations?

I'll be more than happy with "def f:xml():", but I would still vote for the
"def xml:f():" variant, for reasons I mentioned earlier.

Note also the various spacing possibilities. Afaik annotations allow spaces
before and after the ":", and probably how the results would look should
also be considered here.

mario


reply