[Python-ideas] PEP 484 (Type Hints) -- first draft round

Guido van Rossum guido at python.org
Sat Jan 17 03:11:14 CET 2015


On Fri, Jan 16, 2015 at 5:57 PM, Cem Karan <cfkaran2 at gmail.com> wrote:

>
> If we're using decorators for the annotations, why not use them for the
> typing as well?


Because annotations were intended for type hints.


> E.g.,
>
> @typing.type(a, int)
> @doc.doc(a, "some doc")
> def f(a):
>     pass
>
> This would be the equivalent of:
>
> def f(a: {"typing.type": int, "doc.doc": "some doc"}):
>     pass
>
> The whole dictionary idea will be hidden, and annotations can be used for
> other purposes while still supporting typing information.  I'll admit that
> stacking the decorators means the code could get very deep, but it still
> feels like the least bad thing to do.
>

You're taking this "nobody should be more equal than others" thing too far.
:-) We're trying to come up with a standard way of doing one very important
thing.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150116/bd0ad3a2/attachment-0001.html>


More information about the Python-ideas mailing list