[Python-3000] signature annotation in the function signature or a separate line
Samuele Pedroni
pedronis at strakt.com
Sat Aug 19 20:08:08 CEST 2006
Samuele Pedroni wrote:
> Nick Coghlan wrote:
>
>>What would a separate sig expression buy you over defining "->expr" as a
>>special form of keyword argument that binds to the keyword name "return"
>>in the dictionary for storing extra keyword arguments?
>
>
> seems to me a quirky addition of sugar, also could not be limited; I
> prefer going the full length and supporting argument name introduction
> with : etc. as shown in the example.
>
to be more precise, I find:
@sig a: int, b: int -> int
more readable and to the point than: @sig(a=int,b=int,->int).
First-class sig expressions can have rules to leave out parens
as genexp etc.
Also it can be extended to support attaching annotations to * and **
args. It would be hard to devise separate sugar for those.
> But it seems we agree that interspensing the annotation in the main
> head of the function is not such a great idea after all.
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/pedronis%40strakt.com
More information about the Python-3000
mailing list