diff --git a/pep-0618.rst b/pep-0618.rst index 676412774..8d5a9bedc 100644 --- a/pep-0618.rst +++ b/pep-0618.rst @@ -5,13 +5,13 @@ Last-Modified: $Date$ Author: Brandt Bucher Sponsor: Antoine Pitrou BDFL-Delegate: Guido van Rossum -Status: Draft +Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 01-May-2020 Python-Version: 3.10 -Post-History: 01-May-2020, 10-May-2020 -Resolution: +Post-History: 01-May-2020, 10-May-2020, 16-Jun-2020 +Resolution: https://mail.python.org/archives/list/python-dev@python.org/message/NLWB7FVJGMBBMCF4P3ZKUIE53JPDOWJ3 Abstract @@ -119,14 +119,16 @@ occur at the point when iteration would normally stop today. Backward Compatibility ====================== -This change is fully backward-compatible. +This change is fully backward-compatible. ``zip`` currently takes no +keyword arguments, and the "non-strict" default behavior when +``strict`` is omitted remains unchanged. Reference Implementation ======================== The author has drafted a `C implementation -`_. +`_. An approximate Python translation is:: @@ -144,13 +146,16 @@ An approximate Python translation is:: if not strict: return if items: - i = len(items) + 1 - raise ValueError(f"zip() argument {i} is too short") + i = len(items) + plural = " " if i == 1 else "s 1-" + msg = f"zip() argument {i+1} is shorter than argument{plural}{i}" + raise ValueError(msg) sentinel = object() - for i, iterator in enumerate(iterators[1:], 2): + for i, iterator in enumerate(iterators[1:], 1): if next(iterator, sentinel) is not sentinel: - raise ValueError(f"zip() argument {i} is too long") - + plural = " " if i == 1 else "s 1-" + msg = f"zip() argument {i+1} is longer than argument{plural}{i}" + raise ValueError(msg) Rejected Ideas ==============