On Fri, May 8, 2020 at 4:46 PM Henk-Jaap Wagenaar <
[email protected]> wrote:

> On Fri, 8 May 2020 at 14:16, Steven D'Aprano <[email protected]> wrote:
>
>> If you have ever written something like any of these:
>>
>>     list(a) == list(b)
>>     tuple(a) == b
>>     ''.join(chars) == mystring
>>     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:

We could define this .EQ. operate as *sequence equality*, defined very
> roughly as:
>     def .EQ. (a, b):
>         return len(a) == len(b) and all(x==y for x, y in zip(a, b))
> (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.
_______________________________________________
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/WJKNLRIRYT7EFX7ZH2OHXYI772XD5R3J/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to