1# test when we subclass a type with the buffer protocol 2 3class my_bytes(bytes): 4 pass 5 6b1 = my_bytes([0, 1]) 7b2 = my_bytes([2, 3]) 8b3 = bytes([4, 5]) 9 10# addition will use the buffer protocol on the RHS 11print(b1 + b2) 12print(b1 + b3) 13print(b3 + b1) 14 15# bytes construction will use the buffer protocol 16print(bytes(b1)) 17