Inconsistent sequence docs (and perhaps behavior)

Right, bytearray came from bytes and str, which is why it follows their style here (try "abc" + ["d", "e", "f"]), and does not derive/draw inspiration from MutableSequence.[1]

So the questions are:

  • can we clarify the documentation to make it more obvious that bytearray only supports closely-compatible concatenation in + and +=

and

  • can we change bytearray’s behaviour to allow concatenation with more types

The answer to the first one is “yes, with a PR, and we can backport to all versions so the docs are clearer.”

The answer to the second is “maybe, probably needs a PEP or at least a proper design.” Similar recent changes/proposals have had PEPs (the dict union operator, and PEP 467 is still ongoing).


  1. Most of the ABCs are inspired by the concrete implementations, so don’t be too surprised when they don’t match up with every single type consistently. ↩︎