On Fri, May 15, 2020 at 05:46:43PM +0200, Antoine Pitrou wrote:
> On Fri, 15 May 2020 10:46:25 -0400
> David Mertz <me...@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)

I spent a significant amount of time and mental energy explaining in 
detail why a boolean flag is a poor API and is objectively the wrong 
interface here. This is not just a matter of personal taste: there are 
reasons why a flag is wrong here.

Flags are for combining independent and orthogonal settings which can be 
combined. This is not such a feature. I think it is objectively the 
worst API on the table here, for reasons already discussed.

- Your preferred option makes the strict zip version a second-class 
  citizen of the language;

- your preferred option is the least open to future enhancements;

- your most hated option is the one which follows the Zen of Python
  the most closely (namely, the koan about having more namespaces);

- and is the most object-oriented solution (it's effectively a method);

- and most importantly you explicitly *oppose* every alternative API, 
  giving them negative preferences; you would rather not have this zip 
  variant at all than have an interface other than a boolean flag.

If I needed this function[1], I'd accept it even if it were spelled 
`xyghasx.peyahc.flihaj()` and required me to set a global variable to 
make it work. So I can't help but interpret your total opposition to 
every other interface as a strong sign that you don't really need this 
zip variant at all. If your opinion is typical, perhaps we should just 
reject the PEP.

Could you explain why you believe a bool flag is the only 
suitable interface? Objective reasons preferred please.

The same goes for everyone else who gave a vote. If you have an 
objective reason for wanting this strict zip function to be a second 
class citizen that cannot be easily extended in the future, then please 
explain why.



[1] I don't think I do. If I had my preference, thinking only of my own 
needs, I'd probably reject the PEP. But I acknowledge that others seem 
to need it.


-- 
Steven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/XCKLTS2RARQAOJY6RRZB44E5EXZPTFK6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to