On 1 September 2016 at 22:37, Guido van Rossum <gu...@python.org> wrote:
> On Thu, Sep 1, 2016 at 9:30 AM, Ivan Levkivskyi <levkivs...@gmail.com>
wrote:
> > There is a convention for function annotations in PEP 484 that a missing
> > annotation is equivalent to Any, so that I like your first option more.
>
> But Steven wasn't proposing it to mean Any, he was proposing it to
> mean "type checker should infer". Where I presume the inference should
> be done based on the assignment in __init__ only.

Sorry for misunderstanding.

On 2 September 2016 at 04:38, Nick Coghlan <ncogh...@gmail.com> wrote:
> However, a standalone Ellipsis doesn't currently have a meaning as a
> type annotation (it's only meaningful when subscripting Tuple and
> Callable), so a spelling like this might work:
>
>     NAME: ...
>
> That spelling could then also be used in function definitions to say
> "infer the return type from the return statements rather than assuming
> Any"

Interesting idea.
This is somehow similar to one of the existing use of Ellipsis: in numpy it
infers how many dimensions needs to have the full slice, it is like saying
"You know what I mean". So I am +1 on this solution.

--
Ivan
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to