On Wed, May 6, 2020 at 1:42 PM Kirill Balunov <kirillbalunov@gmail.com> wrote:
I'm totally agree with everything you said here. From my perspective, comparing three main cases: 1. zip(*iters, strict= (False | True)) 2. zip(*iters, mode = ('shortest' | 'equal' | 'longest')) 3. zip_equal(*iters)
Thanks for enumerating these. I think that's helpful so I'll flesh it out a bit more. I *think* these are the options on the table: (note, I'm keeping different names for things as the same option, and in no particular order) 1) No change zip(*iters) itertools.zip_longest(*iters, fillvalue=None) 2) Add boolean strict flag to zip zip(*iters, strict= (False | True)) itertools.zip_longest(*iters, fillvalue=None) 3) Add a ternary mode flag to zip zip(*iters, mode = ('shortest' | 'equal' | 'longest'), fillvalue=None) 4) Add a new function to itertools zip(*iters) itertools.zip_longest(*iters, fillvalue=None) itertools.zip_equal(*iters) Brandt: this might be helpful for the PEP. For my part, seeing it this way makes me think that (2) adding a strict flag to zip, while keeping zip_longest on its own in itertools, is the worst option. For me: +1 on the ternary flag +0.5 on a new function in itertools -0 on the boolean flag to zip() -CHB -- Christopher Barker, PhD Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython