On Sun, 14 Jun 2020 at 08:16, Stephen J. Turnbull
<[email protected]> wrote:
> That could be checked by MyPy, without global dataflow analysis.
"MyPy can check this" is a good point that I hadn't considered (I've
not used mypy much myself, yet).
As Chris A says, I'd be inclined to see how far we can get with
(extended) type hints before going for new syntax, though.
> def foo() -> {1, 2, 3}:
> return 2
That is, of course, valid syntax right now. I wonder what a type
checker could do with it? Similarly,
>>> def foo(a: {0, 1, 2}) -> {1, 2, 3}:
... return a+1
...
>>> signature(foo)
<Signature (a: {0, 1, 2}) -> {1, 2, 3}>
>>>
Paul
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/RN6WYZIOO6RFV3Y4LMM5AH5QSHHNBJS4/
Code of Conduct: http://python.org/psf/codeofconduct/