On 05/08/2020 07:50 AM, Alex Hall wrote:
On Fri, May 8, 2020 at 4:46 PM Henk-Jaap Wagenaar wrote:
On Fri, 8 May 2020 at 14:16, Steven D'Aprano <[email protected]
<mailto:[email protected]>> wrote:
If you have ever written something like any of these:
all(x==y for x,y in zip(a, b))
That looks like a zip call that could do with checking its input or strict=True!
Steven mentioned that originally:
(Aside: if we go down this track, this could be a justification for
zip_strict to be a builtin; see the current thread(s) on having a
version of zip which strictly requires its input to be equal length.)
But since you probably want these expressions to evaluate to false rather than
raise an exception when the lengths are different, a strict zip is not
appropriate.
But if:
short_sequence == long_sequence[:len(short_sequence)]
then you'll get True.
--
~Ethan~
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/JK2S6RU5KDUFPPZDJIRER4EYO63GOI2M/
Code of Conduct: http://python.org/psf/codeofconduct/