[Python-ideas] [Python-3000] PEP 3107 Function Annotations: overloadable -> (original) (raw)

Tony Lownds tony at pagedna.com
Tue Jan 2 17:33:00 CET 2007


On Jan 1, 2007, at 10:34 PM, Josiah Carlson wrote:

-1 on the -> operator as specified in the email you link. There is no reason to add aribtrary operators for call-site annotations.

What was the arbitrary operator? -> is not arbitrary, and there was a
reason given to add it.

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)

The mail you link, talks about an arbitrary -> operator for call-site annotations. Without seeing actual use-cases where a -> operator would be useful in the real-world, I can't help but be -1 on the -> operator and -1 on the returns method.

That email had a use case... The gain is being able to write

def wrap(text: str, split: Function(str)-> list):

instead of

def wrap(text: str, split: Function(str) == list):

or

def wrap(text: str, split: Function(str, returns=list)):

or one of the other methods that Kay came up with.

-Tony



More information about the Python-ideas mailing list