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

2020-05-21 Thread Christopher Barker
On Thu, May 21, 2020 at 4:02 AM Steven D'Aprano wrote: > On Wed, May 20, 2020 at 06:31:51PM -0700, Christopher Barker wrote: > > > I'm still confused why the ternary flag (mode) idea never comes up in > these > > arguments -- I know I like that the best. But yeah, I can except that > it's > >

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

2020-05-21 Thread Rob Cliffe via Python-ideas
On 16/05/2020 17:14, Guido van Rossum wrote: On Sat, May 16, 2020 at 1:26 AM Steven D'Aprano > wrote: > * zip(strict=True)       +1 > * zip(mode='strict')     -0 > * itertools.zip_strict() -0.5 > * zip.strict()           -1  (but really, I'd like

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

2020-05-21 Thread Steven D'Aprano
On Wed, May 20, 2020 at 06:31:51PM -0700, Christopher Barker wrote: > I'm still confused why the ternary flag (mode) idea never comes up in these > arguments -- I know I like that the best. But yeah, I can except that it's > dead. Because the standard spelling of flags in ternary logic are True,

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

2020-05-20 Thread Christopher Barker
On Wed, May 20, 2020 at 6:46 AM Steven D'Aprano wrote: > I find it remarkable how people on this > list who often argue "just put it on PyPI" as if that didn't condemn the > proposal to die are now arguing that importing from itertools is an > undue burden. > are you sure it's the SAME people?

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

2020-05-20 Thread Steven D'Aprano
On Sun, May 17, 2020 at 02:43:52PM -0400, David Mertz wrote: > To me, itertools is not some hidden vault only accessible after performing > Herculean labors. +1 to David's observation here. I find it remarkable how people on this list who often argue "just put it on PyPI" as if that didn't

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

2020-05-19 Thread Ethan Furman
On 05/17/2020 12:02 PM, Rob Cliffe via Python-ideas wrote: On 17/05/2020 19:43, David Mertz wrote: The API matter is really orthogonal to this. My point here is that Nathan and some other discussants are operating under the assumption that: "Everyone really wants strict-zip but they just

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

2020-05-19 Thread Rob Cliffe via Python-ideas
On 17/05/2020 19:43, David Mertz wrote: On Sun, May 17, 2020 at 2:09 PM Nathan Schneider > wrote: If you want a better metaphor: Some door handles include locks, others do not.  "Strict" ones have locks.  So yes, it's possible to leave the

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

2020-05-18 Thread Rhodri James
On 17/05/2020 19:43, David Mertz wrote: I believe boolean mode switches are usually a bad design for Python. Not always, there are exceptions like open(). Actually, open() is a really bad example. It does have a flag, "closefd" which if False and a file descriptor was passed in rather than

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

2020-05-17 Thread Oscar Benjamin
On Sun, 17 May 2020 at 07:10, Christopher Barker wrote: > > > PS. Why wasn't a new builtin zip_strict() on the menu? I think I would have > > given it at least +0.5, because of this rule of thumb. > > I would think that if zip_strict() added as a builtin, then zip_longest() > should too. > >

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

2020-05-17 Thread Alex Hall
On Sun, May 17, 2020 at 10:12 PM Ethan Furman wrote: > On 05/17/2020 10:18 AM, Alex Hall wrote: > > > But it's good that we have the assert statement, because it makes it > easy to write safe code and so people are encouraged to do so. > > I could not disagree more strongly with this. Every

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

2020-05-17 Thread Ethan Furman
On 05/17/2020 10:18 AM, Alex Hall wrote: But it's good that we have the assert statement, because it makes it easy to write safe code and so people are encouraged to do so. I could not disagree more strongly with this. Every time I have seen assert used it was in such a way that the

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

2020-05-17 Thread David Mertz
On Sun, May 17, 2020 at 2:09 PM Nathan Schneider wrote: > If you want a better metaphor: Some door handles include locks, others do >> not. "Strict" ones have locks. So yes, it's possible to leave the lock in >> the unlocked position, and then it functions pretty much the same as one >>

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

2020-05-17 Thread Nathan Schneider
On Sun, May 17, 2020 at 1:32 PM David Mertz wrote: > On Sun, May 17, 2020 at 12:22 PM Nathan Schneider > wrote: > >> Let me attempt a metaphor, which won't be perfect but may help: >> >> The safety one gets from strictness is a bit like driving a car wearing a >> seat belt. It is not

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

2020-05-17 Thread David Mertz
On Sun, May 17, 2020 at 12:22 PM Nathan Schneider wrote: > Let me attempt a metaphor, which won't be perfect but may help: > > The safety one gets from strictness is a bit like driving a car wearing a > seat belt. It is not fundamentally different from driving a car without a > seat belt, and in

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

2020-05-17 Thread Alex Hall
On Sun, May 17, 2020 at 6:22 PM Nathan Schneider wrote: > Let me attempt a metaphor, which won't be perfect but may help: > > The safety one gets from strictness is a bit like driving a car wearing a > seat belt. It is not fundamentally different from driving a car without a > seat belt, and in

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

2020-05-17 Thread Nathan Schneider
On Sun, May 17, 2020 at 6:14 AM Rhodri James wrote: > On 16/05/2020 17:14, Guido van Rossum wrote: > > On Sat, May 16, 2020 at 1:26 AM Steven D'Aprano > wrote: > > > >>> * zip(strict=True) +1 > >>> * zip(mode='strict') -0 > >>> * itertools.zip_strict() -0.5 > >>> * zip.strict()

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

2020-05-17 Thread Rhodri James
On 16/05/2020 17:14, Guido van Rossum wrote: On Sat, May 16, 2020 at 1:26 AM Steven D'Aprano wrote: * 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) I spent a significant amount of

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

2020-05-17 Thread Christopher Barker
> PS. Why wasn't a new builtin zip_strict() on the menu? I think I would have given it at least +0.5, because of this rule of thumb. I would think that if zip_strict() added as a builtin, then zip_longest() should too. And the fact that zip_longest was not added as a builtin made me think that

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

2020-05-16 Thread Guido van Rossum
On Sat, May 16, 2020 at 1:26 AM Steven D'Aprano wrote: > > > * 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) > > I spent a significant amount of time and mental energy

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

2020-05-16 Thread Ethan Furman
On 05/16/2020 01:16 AM, Steven D'Aprano wrote: On Fri, May 15, 2020 at 05:46:43PM +0200, Antoine Pitrou wrote: 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) I spent a

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

2020-05-16 Thread Steven D'Aprano
On Fri, May 15, 2020 at 05:46:43PM +0200, Antoine Pitrou wrote: > On Fri, 15 May 2020 10:46:25 -0400 > David Mertz 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,