[Python-3000] Questions on optional type annotations
Nick Coghlan
ncoghlan at gmail.com
Thu May 11 14:50:54 CEST 2006
Talin wrote:
> Guido van Rossum wrote:
>> I think it would be useful to have a notation that can express
>> signatures. I haven't spent much time thinking about what this would
>> look like, but I'd like it to require no new syntax beyond the concept
>> of type annotations. If this means you can't have the inline
>> equivalent of your (int int -> int), then perhaps it could be done by
>> referencing some prototype with the appropriate annotations. Or
>> perhaps someting as crude as Function(type, type, ..., returns=type)
>> would be good enough for inlining this.
>
> I haven't forgotten that you asked me to write up a PEP for a signature
> API in conjunction with the keyword arguments PEP. However, I don't yet
> feel that the ideas have gelled enough to do so yet -- or at least, I
> don't feel competent to come up with a definative solution.
The first draft doesn't have to be definitive :)
However, being able to create a signature object independently of a def
statement is definitely something that should be in there - we'll need it for
annotating C methods anyway, so it may make sense to start with that, and then
look at making it an integral part of the function header afterwards.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list