Re: [Python-ideas] Consider having collections.abc.Sequence

Arek Bulski wrote:
Could use all(a==b for zip(seq,seq2))
Or even `all(itertools.starmap(operator.eq, zip(a, b)))` if you prefer, but this isn’t about how easy or clever or obfuscated one can write that; it’s about convenience. ABCs expose the lowest common denominator for concrete classes of their kind, and having __eq__ makes sense for Sequence (I’m surprised that it’s not already in). I think we can skip the Python-ideas thread and go straight to opening an issue and submitting a patch :) Neil, care to do that? -Emanuel

Sure. http://bugs.python.org/issue27802 On Friday, August 19, 2016 at 8:36:39 AM UTC-4, Emanuel Barry wrote:

On Sat, Aug 20, 2016 at 3:54 PM Michael Selik <michael.selik@gmail.com> wrote:
Of course, that's not how it's done in dynamic languages such as Python (or Java!), so implementing the default __eq__ this way will break symmetry. ~Elazar

Arek Bulski wrote:
Could use all(a==b for zip(seq,seq2))
Or even `all(itertools.starmap(operator.eq, zip(a, b)))` if you prefer, but this isn’t about how easy or clever or obfuscated one can write that; it’s about convenience. ABCs expose the lowest common denominator for concrete classes of their kind, and having __eq__ makes sense for Sequence (I’m surprised that it’s not already in). I think we can skip the Python-ideas thread and go straight to opening an issue and submitting a patch :) Neil, care to do that? -Emanuel

Sure. http://bugs.python.org/issue27802 On Friday, August 19, 2016 at 8:36:39 AM UTC-4, Emanuel Barry wrote:

On Sat, Aug 20, 2016 at 3:54 PM Michael Selik <michael.selik@gmail.com> wrote:
Of course, that's not how it's done in dynamic languages such as Python (or Java!), so implementing the default __eq__ this way will break symmetry. ~Elazar
participants (5)
-
Arek Bulski
-
Emanuel Barry
-
Michael Selik
-
Neil Girdhar
-
אלעזר