[Python-ideas] [Python-3000] PEP 3107 Function Annotations: overloadable ->
Guido van Rossum
guido at python.org
Tue Jan 2 19:48:50 CET 2007
On 1/2/07, Josiah Carlson <jcarlson at uci.edu> wrote:
> > > PEP 3107
> > > has already defined the syntax for function definition site
> > > annotations
> > > as follows...
> > >
> > > def name(argument=default:annotation) -> annotation:
> > > body
> >
> > You mean
> >
> > def name(argument:annotation=default)
>
> Thank you for the correction. Maybe I'm the only one, but I would
> prefer the default value to come before the annotation.
You're about a year and a half too late with this objection. And
anyway, I strongly favor putting the annotation first; that's how it
is in other languages from which Python has borrowed before, e.g.
Modula-3.
Regarding the status of the PEP: I am mostly waiting for the wording
to improve, e.g. not use examples that suggest this will have type
checking semantics by default. I am +1 on the syntax used in the PEP,
since it is what I have been proposing for a long time.
I am against more additions like an '->' operator or attribute
annotations or anything else at this point, at least until there has
been actual experience with using the implementation as-is. (And yes,
I have seen the use case, and remain unconvinced. Not every use case
deserves new syntax.)
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-ideas
mailing list