On Wed, Oct 26, 2022 at 7:32 PM Jelle Zijlstra <jelle.zijlstra@gmail.com> wrote:

The most basic rule in Python typing is that if you put a type X in an annotation, only instances of that type are accepted. Exceptions to that rule are counterintuitive and lead to confusing edge cases. If you want either bytes or bytearray, you should write "bytes | bytearray"; if you want just bytes, you should write "bytes".

+1

Carl