I would like to implement a class which inherits from RawIOBase. I'm struggling to implement the readinto method. Basically, I don't know how to alter the content of the bytearray object passed as a parameter.
I've tried following (naive) approach:
def readinto(self, b):
data = self.read(len(b))
b = data
return len(data)
But this, as I suspect, will assign new bytearray
object to local variable b and it does not change content of the original bytearray
.