On 5/15/2020 11:56 AM, Chris Angelico wrote:
On Sat, May 16, 2020 at 1:54 AM Antoine Pitrou <solipsis@pitrou.net> wrote:
On Fri, 15 May 2020 10:46:25 -0400 David Mertz <mertz@gnosis.cx> wrote:
1. +1 itertools.zip_strict function 2. +1 zip.strict(*args) 3. +1 zip(*args, mode='strict') # mode='shortest' by default 4. +0 zip(*args, strict=True)
Mostly I agree with Steven on relative preference:
itertools.zip_strict() +1 zip.strict() +0.5 zip(mode='strict') +0 zip(strict=True) -0.5 For me:
* zip(strict=True) +1 * zip(mode='strict') -0 * itertools.zip_strict() -0.5 * zip.strict() -1 (but really, I'd like to make this -1e10)
Since we're posting:
itertools.zip_strict() +1 zip.strict() +0.1 zip(strict=True) -0.5 zip(mode='strict') -1
itertools.zip_strict() +1 zip.strict() +0 zip(strict=True) -0 zip(mode='strict') -1 I don't particularly care for "strict", though. It doesn't seem specific enough, and doesn't say "they iterators must return the same number of items" to me. I sort of liked "equal" better, but not so much to make a big stink about it. Also: The PEP says "At most one additional item may be consumed from one of the iterators when compared to normalzip usage." I think this should be prefaced with "If ValueError is raised ...". Also, why does it say "at most one additional item". How could it ever be less than one? Eric