Hello,

On Wed, 15 Jul 2020 23:09:42 -0700
Caleb Donovick <donov...@cs.stanford.edu> wrote:

> I have wanted this and suggested it before for use with typing.
> 
> Defining  protocols is obnoxiously verbose for "struct" like data and
> keyword
> arguments to subscript could help alleviate that.
> I often want to write type hint like this:
> 
> ```
> def foo(x: Protocol[id=int, name=str]):
>       bar(x)
>       baz(x)


Just write them as:

---
from __future__ import annotations

def foo(x: Protocol(id=int, name=str)):
---

So, if using in annotations is the usecase, no new language syntax is
required, just update your "Protocol" definition to
https://www.python.org/dev/peps/pep-0563/

[]

-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/O2CCKMRHWUMGGC2YEHKXXL4ZN3DFYFHJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to