[Python-Dev] Re: OTish: Define Protocols near consumers [was: Keeping Python a Duck Typed Language.]

2021年4月23日 02:55:48 -0700

On 2021年4月23日 at 10:31, Stephen J. Turnbull
<[email protected]> wrote:
> SJIS = 'shift_jisx0213'
>
> *Now* that is a personal protocol, serving the same function of
> telling me "this code deals with a legacy Japanese encoding" and
> implementing it behind the scenes. But I don't see how that can be
> "defined close to its consumers", which are all over the place,
> including interactive sessions.
>
> What am I missing, and how might that be applied to Python?
What you're missing, I think, is that we're talking about
typing.Protocol - see here:
https://docs.python.org/3/library/typing.html#typing.Protocol
Paul
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/E4F6APQCEU3CDP22FPVMGYG6NY4LJWON/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to