[Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations

Brett Cannon brett at python.org
Tue Aug 30 18:48:46 EDT 2016


On Tue, 30 Aug 2016 at 14:21 Guido van Rossum <guido at python.org> wrote:

> I'm happy to present PEP 526 for your collective review:
> https://www.python.org/dev/peps/pep-0526/ (HTML)
> https://github.com/python/peps/blob/master/pep-0526.txt (source)
>
> There's also an implementation ready:
> https://github.com/ilevkivskyi/cpython/tree/pep-526
>
> I don't want to post the full text here but I encourage feedback on
> the high-order ideas, including but not limited to
>
> - Whether (given PEP 484's relative success) it's worth adding syntax
> for variable/attribute annotations.
>

I think so, otherwise type hints are in this weird "half in, half out"
situation in terms of support that only non-OO code can fully utilize.
Either we're going to have type hints for those that want it and properly
support it for full use, or we shouldn't have type hints at all and this
syntax fills in a nice gaps that was a bit awkward to use before.


>
> - Whether the keyword-free syntax idea proposed here is best:
>   NAME: TYPE
>   TARGET: TYPE = VALUE
>

I personally like it. I've been learning Rust lately and it matches up with
their syntax (sans `let`) and I have been happy with it (same goes for
TypeScript's use of the same syntax that Rust uses).

-Brett


>
> Note that there's an extensive list of rejected ideas in the PEP;
> please be so kind to read it before posting here:
>
> https://www.python.org/dev/peps/pep-0526/#rejected-proposals-and-things-left-out-for-now
>
>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/brett%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160830/65caaf5b/attachment.html>


More information about the Python-Dev mailing list