[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-06-02 Thread David Mertz
On Tue, Jun 2, 2020, 9:41 AM Steve Dower > > As is, I use islice() or a break inside a loop, but that hypothetical > parameter might be a helpful > > convenience. > > Besides, "zip(iter1, iter2, range(5))" is the same length once you include > the extra unpack, plus it works well with earlier vers

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-06-02 Thread Steven D'Aprano
On Tue, Jun 02, 2020 at 08:52:46PM +1000, Nick Coghlan wrote: > > Truncate at what? > > > > - some maximum length; > > - some specific element; > > - at the shortest input. > > > > Given that the only input parameters are the iterables themselves, it's a > stretch to even consider the first two a

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-06-02 Thread Steve Dower
On 02Jun2020 1430, David Mertz wrote: On Tue, Jun 2, 2020 at 8:07 AM Chris Angelico > wrote: > Given that the only input parameters are the iterables themselves, it's a stretch to even consider the first two as possibilities. Why? I can conceivably imag

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-06-02 Thread David Mertz
On Tue, Jun 2, 2020 at 8:07 AM Chris Angelico wrote: > > Given that the only input parameters are the iterables themselves, it's > a stretch to even consider the first two as possibilities. > > Why? I can conceivably imagine that zip(iter1, iter2, truncate=5) > would consume at most 5 elements fr

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-06-02 Thread Chris Angelico
On Tue, Jun 2, 2020 at 8:55 PM Nick Coghlan wrote: > > > > On Tue., 2 Jun. 2020, 11:23 am Steven D'Aprano, wrote: >> >> >> >> > The conceptual idea here is that the "truncate" flag name would technically >> > be a shorter mnemonic for "truncate_silently", so clearing it gives you an >> > exceptio

[Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-06-02 Thread Nick Coghlan
On Tue., 2 Jun. 2020, 11:23 am Steven D'Aprano, wrote: > > > > The conceptual idea here is that the "truncate" flag name would > technically > > be a shorter mnemonic for "truncate_silently", so clearing it gives you > an > > exception rather enabling padding behaviour. > > > > Flipping the sense