[Python-3000] Draft pre-PEP: function annotations
Talin
talin at acm.org
Thu Aug 10 02:51:02 CEST 2006
Collin Winter wrote:
> There is no worry that these libraries will assign semantics at
> random, or that a variety of libraries will appear, each with varying
> semantics and interpretations of what, say, a tuple of strings
> means. 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.
I find this assumption extremely dubious.
> In pseudo-grammar, parameters now look like
> ``identifier [: expression] [= expression]``. That is, type
> annotations always precede a parameter's default value and both type
> annotations and default values are optional. Just like how equal
> signs are used to indicate a default value, colons are used to mark
> annotations. All annotation expressions are evaluated at the time
> the function is compiled.
Only one annotation per parameter? What if I want to specify both a
docstring *and* a type constraint?
-- Talin
More information about the Python-3000
mailing list