[Python-3000] Draft pre-PEP: function annotations (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Aug 10 04:47:48 CEST 2006


Collin Winter wrote:

one library might use string-based annotations to provide improved help messages, like so:

def compile(source: "something compilable", filename: "where the compilable thing comes from", mode: "is this a single statement or a suite?"): Another library might be used to provide typechecking for Python functions and methods. def sum(*vargs: Number) -> Number: ...

And what are you supposed to do if you want to write a function that has improved help messages and type checking?

The difficulty inherent in writing annotation interpreting libraries will keep their number low and their authorship in the hands of people who, frankly, know what they're doing.

Even if there are only two of them, they can still conflict.

I think the idea of having totally undefined annotations is fundamentally flawed.

-- Greg



More information about the Python-3000 mailing list