diff options
author | Ivan Levkivskyi <levkivskyi@gmail.com> | 2019-05-28 07:40:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-28 07:40:15 (GMT) |
commit | 74d7f76e2c953fbfdb7ce01b7319d91d471cc5ef (patch) | |
tree | 6bba7b64dc4b4a88569809f0758113c87bb690b4 /Misc/NEWS.d/next | |
parent | 3880f263d2994fb1eba25835dddccb0cf696fdf0 (diff) | |
download | cpython-74d7f76e2c953fbfdb7ce01b7319d91d471cc5ef.zip cpython-74d7f76e2c953fbfdb7ce01b7319d91d471cc5ef.tar.gz cpython-74d7f76e2c953fbfdb7ce01b7319d91d471cc5ef.tar.bz2 |
bpo-37058: PEP 544: Add Protocol to typing module (GH-13585)
I tried to get rid of the `_ProtocolMeta`, but unfortunately it didn'y work. My idea to return a generic alias from `@runtime_checkable` made runtime protocols unpickleable. I am not sure what is worse (a custom metaclass or having some classes unpickleable), so I decided to stick with the status quo (since there were no complains so far). So essentially this is a copy of the implementation in `typing_extensions` with two modifications:
* Rename `@runtime` to `@runtime_checkable` (plus corresponding updates).
* Allow protocols that extend `collections.abc.Iterable` etc.
Diffstat (limited to 'Misc/NEWS.d/next')
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-05-26-19-05-24.bpo-37058.jmRu_g.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-05-26-19-05-24.bpo-37058.jmRu_g.rst b/Misc/NEWS.d/next/Library/2019-05-26-19-05-24.bpo-37058.jmRu_g.rst new file mode 100644 index 0000000..329b82c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-26-19-05-24.bpo-37058.jmRu_g.rst @@ -0,0 +1 @@ +PEP 544: Add ``Protocol`` and ``@runtime_checkable`` to the ``typing`` module.
\ No newline at end of file |