[Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
Ivan Levkivskyi
levkivskyi at gmail.com
Fri Sep 2 09:43:40 EDT 2016
More information about the Python-Dev mailing list
Fri Sep 2 09:43:40 EDT 2016
- Previous message (by thread): [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
- Next message (by thread): [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1 September 2016 at 22:37, Guido van Rossum <guido at python.org> wrote: > On Thu, Sep 1, 2016 at 9:30 AM, Ivan Levkivskyi <levkivskyi at 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 <ncoghlan at 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160902/f4cafbef/attachment-0001.html>
- Previous message (by thread): [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
- Next message (by thread): [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list