[Python-ideas] Optional static typing -- the crossroads
Guido van Rossum
guido at python.org
Fri Aug 15 21:33:07 CEST 2014
On Fri, Aug 15, 2014 at 12:11 PM, Sunjay Varma <varma.sunjay at gmail.com>
wrote:
>
> On Aug 15, 2014 2:55 PM, "Łukasz Langa" <lukasz at langa.pl> wrote:
> >
> > 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
>
> I'm all for compatibility, but Python 3 already breaks compatibility with
> Python 2. Why not add this feature in Python 4 (or whatever the next
> breaking release is) and do it "right" the first time. I don't think it
> makes sense to start muddling up the different semantic meanings of
> Python's operations just because we think it will break in an older
> version.
>
There won't *be* a "next breaking release".
> This is such a big and important change. It deserves its own syntax (and
> if necessary a new version number as well).
>
> > 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
>
> Angle brackets were just a suggestion as they are used frequently by other
> languages. Even braces would be more appropriate as they're already built
> into the lexer and dict{int, str} clearly means something different than
> dict[int, str].
>
> >
> > All in all, this is more trouble than it’s worth.
>
> I can understand that it's easier to use what's already there, but I don't
> agree with doing something just because it's easier. Especially when the
> side effects are not at all appealing.
>
I don't think you quite appreciate the art of language evolution.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140815/159bdae4/attachment.html>
More information about the Python-ideas
mailing list