[Python-ideas] Optional static typing -- the crossroads

Łukasz Langa lukasz at langa.pl
Fri Aug 15 20:55:44 CEST 2014


On Aug 15, 2014, at 11:43 AM, Sunjay Varma <varma.sunjay at gmail.com> wrote:
> Hi all,
> Has the syntax for specifying type been fully decided on already?
> 
> Using brackets may confuse new Python programmers. (…) Other languages use angle brackets to specify types.
> 


I also agree that angle brackets would be nicer. Guido decided against it for pragmatic reasons:
1. angle brackets would create Python source code incompatible with any version lower than 3.5
2. angle brackets would complicate the lexer (normally you expect < and > to be spaced, in this case it wouldn’t)
3. angle brackets would require a new mechanism in Python to store this kind of expression within the type; this is still true for generics expressed with square brackets but at least you can use the existing nuts and bolts of Python classes

All in all, this is more trouble than it’s worth.

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140815/e32a2e06/attachment-0001.html>


More information about the Python-ideas mailing list