PEP 3107 Function Annotations for review and comment

Tony Lownds tony at PageDNA.com
Fri Dec 29 20:08:02 EST 2006


On Dec 29, 2006, at 4:09 PM, BJörn Lindqvist wrote:
>
> I think this rationale is very lacking and to weak for such a big
> change to Python. I definitely like to see it expanded.
>
> The reference links to two small libraries implementing type checking
> using decorators and doc strings. None of which to seem to be very
> popular in the Python community. Surely, those two libraries *alone*
> can't be enough of a motivation for this? To me, it is far from
> self-evident what purpose function annotations would serve.
>
> I also wonder why a very obtrusive syntax addition is needed when it
> clearly is possible to annotate functions in today's Python. Why is
> syntax better than just adding a function annotation decorator to the
> standard library?
>
>     @annotate(a = int, b = dict, c = int)
>     def foo(a, b, c = 5):
>         ...
>
> Are decorators to ugly?

The syntax does look better than a decorator. The syntax also provides
a notation for documentation to follow. Even a standard decorator won't
help with that. I am surprised you think the syntax is more  
obstrusive than the
decorator.

-Tony

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061229/ec9874d1/attachment.html>


More information about the Python-list mailing list