Hi Caleb

You wrote (call it FUTURE)

> def foo(x: Protocol[id=int, name=str]):
>       bar(x)
>       baz(x)
>

 As you know, at present this causes a SyntaxError.

However (call it NOW)
    def foo(x: Protocol[o(id=int, name=str])):
          bar(x)
          baz(x)
has no syntax error.

I'll now state some goals.

1. Define 'o' and Protocol so that NOW gives the semantics you wish for.
2. Extend Python so that FUTURE give the semantics you wish for.
3. And the NOW syntax continues to work as expected (without changing 'o'
and Protocol).
4. And all current use of container[key] continues to work as before.

I believe that it is possible to achieve these goals. My previous posts to
this discussion outline some of the key ideas. My next step, when I have
time, is to implement and publish general purpose code for the NOW part of
this list of goals.

I hope this will help you and others.

with best regards

Jonathan
_______________________________________________
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/3IWL42XYUVODDVTPXF7EKXF6NE4JCRTV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to