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>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4